aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/f95-lang.cc
diff options
context:
space:
mode:
authorTakayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>2022-09-09 06:16:31 +0900
committerMax Filippov <jcmvbkbc@gmail.com>2022-09-09 15:19:50 -0700
commit06c2756e824cfe409d280fc78a0c4f68a9123e49 (patch)
tree0ea450458e0da5cb3da09c4429bd1e2e9b20e314 /gcc/fortran/f95-lang.cc
parentc81b60b8c6ff3d4db2e395a628e114df812cfc48 (diff)
downloadgcc-06c2756e824cfe409d280fc78a0c4f68a9123e49.zip
gcc-06c2756e824cfe409d280fc78a0c4f68a9123e49.tar.gz
gcc-06c2756e824cfe409d280fc78a0c4f68a9123e49.tar.bz2
xtensa: Eliminate unused stack frame allocation/freeing
In the example below, 'x' is once placed on the stack frame and then read into registers as the argument value of bar(): /* example */ struct foo { int a, b; }; extern struct foo bar(struct foo); struct foo test(void) { struct foo x = { 0, 1 }; return bar(x); } Thanks to the dead store elimination, the initialization of 'x' turns into merely loading the immediates to registers, but corresponding stack frame growth is not rolled back. As a result: ;; prereq: the CALL0 ABI ;; before test: addi sp, sp, -16 // unused stack frame allocation/freeing movi.n a2, 0 movi.n a3, 1 addi sp, sp, 16 // because no instructions that refer to j.l bar, a9 // the stack pointer between the two This patch eliminates such unused stack frame allocation/freeing: ;; after test: movi.n a2, 0 movi.n a3, 1 j.l bar, a9 gcc/ChangeLog: * config/xtensa/xtensa.cc (machine_function): New boolean member as a flag that controls whether to emit the insns for stack pointer adjustment inside of the pro/epilogue. (xtensa_emit_adjust_stack_ptr): New function to share the common codes and to emit insns if not inhibited. (xtensa_expand_epilogue): Change to use the function mentioned above when using the CALL0 ABI. (xtensa_expand_prologue): Ditto. And also change to set the inhibit flag used by xtensa_emit_adjust_stack_ptr() to true if the stack pointer is only used for its own adjustment.
Diffstat (limited to 'gcc/fortran/f95-lang.cc')
0 files changed, 0 insertions, 0 deletions