diff options
author | Denis Chertykov <denisc@overta.ru> | 2002-10-10 19:45:59 +0000 |
---|---|---|
committer | Denis Chertykov <denisc@gcc.gnu.org> | 2002-10-10 23:45:59 +0400 |
commit | b6878188455ecc1deb8a40fd30649710380a82e5 (patch) | |
tree | 1782ee906b22c9d264a4b143b433ef0d5e6b0e3b /gcc | |
parent | f930bfd067f2cfb739d544a5decec4bc860de28c (diff) | |
download | gcc-b6878188455ecc1deb8a40fd30649710380a82e5.zip gcc-b6878188455ecc1deb8a40fd30649710380a82e5.tar.gz gcc-b6878188455ecc1deb8a40fd30649710380a82e5.tar.bz2 |
ip2k.c (function_epilogue): Optimize stack deallocation.
* config/ip2k/ip2k.c (function_epilogue): Optimize stack
deallocation.
* config/ip2k/libgcc.S: Combine routines used by function
epilogue.
From-SVN: r58027
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/ip2k/ip2k.c | 92 | ||||
-rw-r--r-- | gcc/config/ip2k/libgcc.S | 42 | ||||
-rw-r--r-- | gcc/config/ip2k/t-ip2k | 3 |
4 files changed, 73 insertions, 71 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8206b2d..8dadd8e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2002-10-10 Denis Chertykov <denisc@overta.ru> + + * config/ip2k/ip2k.c (function_epilogue): Optimize stack + deallocation. + * config/ip2k/libgcc.S: Combine routines used by function + epilogue. + 2002-10-10 Jim Wilson <wilson@redhat.com> * cse.c (fold_rtx): Don't perform associative optimization for DIV and diff --git a/gcc/config/ip2k/ip2k.c b/gcc/config/ip2k/ip2k.c index 9b392f5..36c9b5f 100644 --- a/gcc/config/ip2k/ip2k.c +++ b/gcc/config/ip2k/ip2k.c @@ -304,6 +304,8 @@ function_epilogue (file, size) int leaf_func_p; int reg,savelimit; rtx operands[2]; /* Dummy used by OUT_ASn */ + int args_locals_size = current_function_args_size; + int saved_regs_p = 0; int need_ret = 1; /* Use this opportunity to reset the reorg flags! */ @@ -325,42 +327,54 @@ function_epilogue (file, size) epilogue_size = 0; fprintf (file, "/* epilogue: frame size=%d */\n", size); + savelimit = (CHAIN_FRAMES) ? REG_FP : (REG_FP + 2); + for (reg = 0; reg < savelimit; reg++) + if (regs_ever_live[reg] && ! call_used_regs[reg]) + { + saved_regs_p = 1; + break; + } + if (size) { - operands[0] = GEN_INT (size); - - switch (size & 0xff) + if (leaf_func_p && !CHAIN_FRAMES && !saved_regs_p + && current_function_pops_args) + args_locals_size = current_function_args_size + size; + else { - default: - OUT_AS2 (mov, w, %L0); - OUT_AS2 (add, spl, w); - epilogue_size += 4; - /* fall-thru */ - case 0: - break; - case 1: - OUT_AS1 (inc, spl); - epilogue_size += 2; - } + operands[0] = GEN_INT (size); - switch (size & 0xff00) - { - default: - if ((size & 0xff) != ((size >> 8) & 0xff)) - OUT_AS2 (mov, w, %H0); - OUT_AS2 (add, sph, w); - epilogue_size += 4; - /* fall-thru */ - case 0: - break; - case 0x100: - OUT_AS1 (inc, sph); - epilogue_size += 2; + switch (size & 0xff) + { + default: + OUT_AS2 (mov, w, %L0); + OUT_AS2 (add, spl, w); + epilogue_size += 4; + /* fall-thru */ + case 0: + break; + case 1: + OUT_AS1 (inc, spl); + epilogue_size += 2; + } + + switch (size & 0xff00) + { + default: + if ((size & 0xff) != ((size >> 8) & 0xff)) + OUT_AS2 (mov, w, %H0); + OUT_AS2 (add, sph, w); + epilogue_size += 4; + /* fall-thru */ + case 0: + break; + case 0x100: + OUT_AS1 (inc, sph); + epilogue_size += 2; + } } } - savelimit = (CHAIN_FRAMES) ? REG_FP : (REG_FP + 2); - for (reg = 0; reg < savelimit; reg++) { if (regs_ever_live[reg] && ! call_used_regs[reg]) @@ -428,10 +442,10 @@ function_epilogue (file, size) else { if (current_function_pops_args - && current_function_args_size >= 2 - && current_function_args_size < 0x100) + && args_locals_size >= 2 + && args_locals_size < 0x100) { - if (current_function_args_size == 2) + if (args_locals_size == 2) { if (CHAIN_FRAMES) { @@ -443,7 +457,7 @@ function_epilogue (file, size) } else { - operands[0] = GEN_INT (current_function_args_size); + operands[0] = GEN_INT (args_locals_size); if (CHAIN_FRAMES) { OUT_AS2 (mov, w, %L0); @@ -456,12 +470,11 @@ function_epilogue (file, size) } } - if (current_function_pops_args && current_function_args_size - && need_ret) + if (current_function_pops_args && args_locals_size && need_ret) { - operands[0] = GEN_INT (current_function_args_size); + operands[0] = GEN_INT (args_locals_size); - switch (current_function_args_size & 0xff) + switch (args_locals_size & 0xff) { default: OUT_AS2 (mov, w, %L0); @@ -477,11 +490,10 @@ function_epilogue (file, size) epilogue_size += 2; } - switch (current_function_args_size & 0xff00) + switch (args_locals_size & 0xff00) { default: - if ((current_function_args_size & 0xff) - != ((current_function_args_size >> 8) & 0xff)) + if ((args_locals_size & 0xff) != ((args_locals_size >> 8) & 0xff)) OUT_AS2 (mov, w, %H0); OUT_AS2 (add, sph, w); epilogue_size += 4; diff --git a/gcc/config/ip2k/libgcc.S b/gcc/config/ip2k/libgcc.S index 2522a5e..fb0c988 100644 --- a/gcc/config/ip2k/libgcc.S +++ b/gcc/config/ip2k/libgcc.S @@ -1,4 +1,3 @@ -; libgcc.S for the Ubicom IP2k architecture. ; ; Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. ; Contributed by Red Hat, Inc and Ubicom, Inc. @@ -1327,8 +1326,11 @@ __cmpdi2_dp: .sect .pram.libgcc,"ax" .global __fp_pop_args_ret .global __pop_args_ret - .func __fp_pop_args_ret, __fp_pop_args_ret + .global __pop2_args_ret + .func __fp_pop2_args_ret, __fp_pop2_args_ret +__fp_pop2_args_ret: + mov w, #2 __fp_pop_args_ret: pop 0xfd pop 0xfe @@ -1341,29 +1343,11 @@ __pop_args_ret: .endfunc #endif /* L_fp_pop_args_ret */ -#if defined(L_leaf_fp_pop_args_ret) - .sect .pram.libgcc,"ax" - .global __leaf_fp_pop_args_ret - .func __leaf_fp_pop_args_ret, __leaf_fp_pop_args_ret - -__leaf_fp_pop_args_ret: - pop 0xfd - pop 0xfe - add spl, w - ret - - .endfunc -#endif /* L_leaf_fp_pop_args_ret */ - -#if defined(L_fp_pop2_args_ret) +#if defined(L__pop2_args_ret) .sect .pram.libgcc,"ax" - .global __fp_pop2_args_ret .global __pop2_args_ret - .func __fp_pop2_args_ret, __fp_pop2_args_ret + .func __pop2_args_ret, __pop2_args_ret -__fp_pop2_args_ret: - pop 0xfd - pop 0xfe __pop2_args_ret: mov w, #2 pop callh @@ -1372,22 +1356,23 @@ __pop2_args_ret: ret .endfunc -#endif /* L_fp_pop2_args_ret */ +#endif /* L__pop2_args_ret */ -#if defined(L_leaf_fp_pop2_args_ret) +#if defined(L_leaf_fp_pop_args_ret) .sect .pram.libgcc,"ax" - .global __leaf_fp_pop2_args_ret - .func __leaf_fp_pop2_args_ret, __leaf_fp_pop2_args_ret + .global __leaf_fp_pop_args_ret, __leaf_fp_pop2_args_ret + .func __leaf_fp2_pop_args_ret, __leaf_fp_pop2_args_ret __leaf_fp_pop2_args_ret: + mov w, #2 +__leaf_fp_pop_args_ret: pop 0xfd pop 0xfe - mov w, #2 add spl, w ret .endfunc -#endif /* L_leaf_fp_pop2_args_ret */ +#endif /* L_leaf_fp_pop_args_ret */ #if defined(L_movstrhi_countqi) .sect .pram.libgcc,"ax" @@ -1529,4 +1514,3 @@ _write: .endfunc #endif - diff --git a/gcc/config/ip2k/t-ip2k b/gcc/config/ip2k/t-ip2k index 7d82126..7a59a70 100644 --- a/gcc/config/ip2k/t-ip2k +++ b/gcc/config/ip2k/t-ip2k @@ -17,9 +17,8 @@ LIB1ASMFUNCS = \ _cmpdi2 \ _cmpdi2_dp \ _fp_pop_args_ret \ + _pop2_args_ret \ _leaf_fp_pop_args_ret \ - _fp_pop2_args_ret \ - _leaf_fp_pop2_args_ret \ _movstrhi_countqi \ _movstrhi_counthi \ abort \ |