This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Help: webizer pass vs. i386's TARGET_STACK_PROBE
- From: Jan Hubicka <jh at suse dot cz>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Jan Hubicka <jh at suse dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 29 Dec 2003 11:53:57 +0100
- Subject: Re: Help: webizer pass vs. i386's TARGET_STACK_PROBE
- References: <20031220002900.GA6211@kam.mff.cuni.cz> <Pine.LNX.4.44.0312201310300.6897-100000@www.eyesopen.com>
>
> On Sat, 20 Dec 2003, Jan Hubicka wrote:
> > The problem actually is that before reload, we have to use
> > match_scratch, while after reload we must not introduce that scratch.
> > What fun.
> > The attached patch works on your testcase but I can't bootstrap it as I
> > don't have windows handy. Hope it will work for you this time.
>
> Excellent! This patch bootstraps all languages except ada and treelang
> on i686-pc-cygwin. It both fixes my proprietary test case and now allows
> i686-pc-cywgin to bootstrap with BOOT_CFLAGS="-O3 -g".
>
> Unfortunately, I don't have cygwin configured to run the testsuite :<
>
> However, your latest patch is clearly an improvement. If you post it
> to gcc-patches with a ChangeLog, I'll be happy to approve it for you.
>
> Once again, very many thanks!
Sorry for taking time over christmas. Here is patch with changelog
additionally tested on i686-pc-gnu-linux and x86_64-linux
2003-12-29 Jan Hubicka <jh@suse.cz>
* i386.md (allocate_stack_worker): Use different pattern for pre and
post reload expansion.
(allocate_stack_worker_1, allocate_stack_worker_rex64): Use
match_scratch.
(allocate_stack_worder_1_postreload,
allocate_stack_worker_rex64_postreload): New.
Index: i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.494
diff -c -3 -p -r1.494 i386.md
*** i386.md 13 Dec 2003 04:44:05 -0000 1.494
--- i386.md 20 Dec 2003 00:24:41 -0000
***************
*** 17168,17199 ****
[(match_operand:SI 0 "register_operand" "")]
"TARGET_STACK_PROBE"
{
! if (TARGET_64BIT)
! emit_insn (gen_allocate_stack_worker_rex64 (operands[0]));
else
! emit_insn (gen_allocate_stack_worker_1 (operands[0]));
DONE;
})
(define_insn "allocate_stack_worker_1"
[(unspec:SI [(match_operand:SI 0 "register_operand" "a")] UNSPEC_STACK_PROBE)
(set (reg:SI 7) (minus:SI (reg:SI 7) (match_dup 0)))
! (clobber (match_dup 0))
(clobber (reg:CC 17))]
"!TARGET_64BIT && TARGET_STACK_PROBE"
"call\t__alloca"
[(set_attr "type" "multi")
(set_attr "length" "5")])
(define_insn "allocate_stack_worker_rex64"
[(unspec:DI [(match_operand:DI 0 "register_operand" "a")] UNSPEC_STACK_PROBE)
(set (reg:DI 7) (minus:DI (reg:DI 7) (match_dup 0)))
! (clobber (match_dup 0))
(clobber (reg:CC 17))]
"TARGET_64BIT && TARGET_STACK_PROBE"
"call\t__alloca"
[(set_attr "type" "multi")
(set_attr "length" "5")])
(define_expand "allocate_stack"
[(parallel [(set (match_operand:SI 0 "register_operand" "=r")
--- 17168,17227 ----
[(match_operand:SI 0 "register_operand" "")]
"TARGET_STACK_PROBE"
{
! if (reload_completed)
! {
! if (TARGET_64BIT)
! emit_insn (gen_allocate_stack_worker_rex64_postreload (operands[0]));
! else
! emit_insn (gen_allocate_stack_worker_postreload (operands[0]));
! }
else
! {
! if (TARGET_64BIT)
! emit_insn (gen_allocate_stack_worker_rex64 (operands[0]));
! else
! emit_insn (gen_allocate_stack_worker_1 (operands[0]));
! }
DONE;
})
(define_insn "allocate_stack_worker_1"
[(unspec:SI [(match_operand:SI 0 "register_operand" "a")] UNSPEC_STACK_PROBE)
(set (reg:SI 7) (minus:SI (reg:SI 7) (match_dup 0)))
! (clobber (match_scratch:SI 1 "=0"))
(clobber (reg:CC 17))]
"!TARGET_64BIT && TARGET_STACK_PROBE"
"call\t__alloca"
[(set_attr "type" "multi")
(set_attr "length" "5")])
+ (define_expand "allocate_stack_worker_postreload"
+ [(parallel [(unspec:SI [(match_operand:SI 0 "register_operand" "a")]
+ UNSPEC_STACK_PROBE)
+ (set (reg:SI 7) (minus:SI (reg:SI 7) (match_dup 0)))
+ (clobber (match_dup 0))
+ (clobber (reg:CC 17))])]
+ ""
+ "")
+
(define_insn "allocate_stack_worker_rex64"
[(unspec:DI [(match_operand:DI 0 "register_operand" "a")] UNSPEC_STACK_PROBE)
(set (reg:DI 7) (minus:DI (reg:DI 7) (match_dup 0)))
! (clobber (match_scratch:DI 1 "=0"))
(clobber (reg:CC 17))]
"TARGET_64BIT && TARGET_STACK_PROBE"
"call\t__alloca"
[(set_attr "type" "multi")
(set_attr "length" "5")])
+
+ (define_expand "allocate_stack_worker_rex64_postreload"
+ [(parallel [(unspec:DI [(match_operand:DI 0 "register_operand" "a")]
+ UNSPEC_STACK_PROBE)
+ (set (reg:DI 7) (minus:DI (reg:DI 7) (match_dup 0)))
+ (clobber (match_dup 0))
+ (clobber (reg:CC 17))])]
+ ""
+ "")
(define_expand "allocate_stack"
[(parallel [(set (match_operand:SI 0 "register_operand" "=r")