diff options
author | Sa Liu <saliu@de.ibm.com> | 2007-01-10 05:24:01 +0000 |
---|---|---|
committer | Ben Elliston <bje@gcc.gnu.org> | 2007-01-10 16:24:01 +1100 |
commit | e1f1d97f19dc76735e2a6ac743ee31e545264969 (patch) | |
tree | bea351683ab93d045457f78d4bf70cf776fb658d /gcc/config/spu/spu.md | |
parent | 0b30ba3b6c852a87355a84a3bcf179b1526ed37b (diff) | |
download | gcc-e1f1d97f19dc76735e2a6ac743ee31e545264969.zip gcc-e1f1d97f19dc76735e2a6ac743ee31e545264969.tar.gz gcc-e1f1d97f19dc76735e2a6ac743ee31e545264969.tar.bz2 |
spu.h (STACK_SAVE_AREA): Use VOIDmode for SAVE_FUNCTION...
* spu.h (STACK_SAVE_AREA): Use VOIDmode for SAVE_FUNCTION, SImode
for SAVE_NONLOCAL and Pmode for any other save level.
* spu-protos.h (spu_restore_stack_block): Declare.
* spu.md (save_stack_block): Remove.
(restore_stack_block): Call spu_restore_stack_block.
* spu.c (spu_restore_stack_block): New function.
(spu_expand_epilogue): Remove old comment.
Co-Authored-By: Ben Elliston <bje@au.ibm.com>
From-SVN: r120633
Diffstat (limited to 'gcc/config/spu/spu.md')
-rw-r--r-- | gcc/config/spu/spu.md | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/gcc/config/spu/spu.md b/gcc/config/spu/spu.md index 7978361..8e8fad2 100644 --- a/gcc/config/spu/spu.md +++ b/gcc/config/spu/spu.md @@ -1,4 +1,4 @@ -;; Copyright (C) 2006 Free Software Foundation, Inc. +;; Copyright (C) 2006, 2007 Free Software Foundation, Inc. ;; This file is free software; you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free @@ -3116,16 +3116,19 @@ selb\t%0,%4,%0,%3" "spu_allocate_stack (operands[0], operands[1]); DONE;") ;; These patterns say how to save and restore the stack pointer. We need not -;; save the stack pointer at function or block level since we are careful to -;; preserve the backchain. Doing nothing at block level means the stack space -;; is allocated until the end of the function. This is currently safe to do -;; because gcc uses the frame pointer for the whole function, so the worst that -;; happens is wasted stack space. That could be bad if a VLA is declared in a -;; loop, because new space will be allocated every iteration, but users can -;; work around that case. Ideally we could detect when we are in a loop and -;; generate the more complicated code in that case. +;; save the stack pointer at function level since we are careful to preserve +;; the backchain. +;; + +;; At block level the stack pointer is saved and restored, so that the +;; stack space allocated within a block is deallocated when leaving +;; block scope. By default, according to the SPU ABI, the stack +;; pointer and available stack size are saved in a register. Upon +;; restoration, the stack pointer is simply copied back, and the +;; current available stack size is calculated against the restored +;; stack pointer. ;; -;; For nonlocal gotos, we must save both the stack pointer and its +;; For nonlocal gotos, we must save the stack pointer and its ;; backchain and restore both. Note that in the nonlocal case, the ;; save area is a memory location. @@ -3141,19 +3144,15 @@ selb\t%0,%4,%0,%3" "" "DONE;") -(define_expand "save_stack_block" - [(match_operand 0 "general_operand" "") - (match_operand 1 "general_operand" "")] - "" - "DONE; ") - (define_expand "restore_stack_block" - [(use (match_operand 0 "spu_reg_operand" "")) - (set (match_dup 2) (match_dup 3)) - (set (match_dup 0) (match_operand 1 "spu_reg_operand" "")) - (set (match_dup 3) (match_dup 2))] + [(match_operand 0 "spu_reg_operand" "") + (match_operand 1 "memory_operand" "")] "" - "DONE;") + " + { + spu_restore_stack_block (operands[0], operands[1]); + DONE; + }") (define_expand "save_stack_nonlocal" [(match_operand 0 "memory_operand" "") |