From 825527e8a6992ca4acbcc2f9e33b18f1b1a09725 Mon Sep 17 00:00:00 2001 From: "Edgar E. Iglesias" Date: Sun, 17 Feb 2013 16:18:09 +0000 Subject: [PATCH] Free variable local allocs at block ends. * config/microblaze/microblaze.md (save_stack_block): Define. (restore_stack_block): Likewise. From-SVN: r196110 --- gcc/ChangeLog | 5 +++++ gcc/config/microblaze/microblaze.md | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1373e8bc9bf..dbf8a173328 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-02-17 Edgar E. Iglesias + + * config/microblaze/microblaze.md (save_stack_block): Define. + (restore_stack_block): Likewise. + 2013-02-16 Edgar E. Iglesias * config/microblaze/linux.h (TARGET_SUPPORTS_PIC): Define as 1. diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md index 69df5922052..1d55a167be4 100644 --- a/gcc/config/microblaze/microblaze.md +++ b/gcc/config/microblaze/microblaze.md @@ -1860,6 +1860,32 @@ } ) +(define_expand "save_stack_block" + [(match_operand 0 "register_operand" "") + (match_operand 1 "register_operand" "")] + "" + { + emit_move_insn (operands[0], operands[1]); + DONE; + } +) + +(define_expand "restore_stack_block" + [(match_operand 0 "register_operand" "") + (match_operand 1 "register_operand" "")] + "" + { + rtx retaddr = gen_rtx_MEM (Pmode, stack_pointer_rtx); + rtx rtmp = gen_rtx_REG (SImode, R_TMP); + + /* Move the retaddr. */ + emit_move_insn (rtmp, retaddr); + emit_move_insn (operands[0], operands[1]); + emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), rtmp); + DONE; + } +) + ;; Trivial return. Make it look like a normal return insn as that ;; allows jump optimizations to work better . (define_expand "return" -- 2.30.2