aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/riscv
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>2018-01-08 16:45:46 -0800
committerJim Wilson <wilson@gcc.gnu.org>2018-01-08 16:45:46 -0800
commitc8a0c7b660a96081f320c8155f135a46b2202968 (patch)
tree1ec950b0acd31b52fdea6aed493eb151f61e2a34 /gcc/config/riscv
parentb48ae4b0809cc56c645de45008e7ce886987fa3b (diff)
downloadgcc-c8a0c7b660a96081f320c8155f135a46b2202968.zip
gcc-c8a0c7b660a96081f320c8155f135a46b2202968.tar.gz
gcc-c8a0c7b660a96081f320c8155f135a46b2202968.tar.bz2
RISC-V: Fix -msave-restore bug with sibcalls.
2018-01-08 Monk Chiang <sh.chiang04@gmail.com> Kito Cheng <kito.cheng@gmail.com> gcc/ * config/riscv/riscv.c (machine_function::is_leaf): Remove field. (riscv_leaf_function_p): Delete. (riscv_function_ok_for_sibcall): Return false when TARGET_SAVE_RESTORE. 2018-01-08 Chih-Mao Chen <pkmx.tw@gmail.com> Monk Chiang <sh.chiang04@gmail.com> gcc/testsuite/ * gcc.target/riscv/save-restore-1.c: New. From-SVN: r256362
Diffstat (limited to 'gcc/config/riscv')
-rw-r--r--gcc/config/riscv/riscv.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
index 39e1250..b6270f7 100644
--- a/gcc/config/riscv/riscv.c
+++ b/gcc/config/riscv/riscv.c
@@ -127,9 +127,6 @@ struct GTY(()) machine_function {
This area is allocated by the callee at the very top of the frame. */
int varargs_size;
- /* Memoized return value of leaf_function_p. <0 if false, >0 if true. */
- int is_leaf;
-
/* The current frame information, calculated by riscv_compute_frame_info. */
struct riscv_frame_info frame;
};
@@ -4176,26 +4173,15 @@ riscv_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
emit_insn (gen_clear_cache (addr, end_addr));
}
-/* Return leaf_function_p () and memoize the result. */
-
-static bool
-riscv_leaf_function_p (void)
-{
- if (cfun->machine->is_leaf == 0)
- cfun->machine->is_leaf = leaf_function_p () ? 1 : -1;
-
- return cfun->machine->is_leaf > 0;
-}
-
/* Implement TARGET_FUNCTION_OK_FOR_SIBCALL. */
static bool
riscv_function_ok_for_sibcall (tree decl ATTRIBUTE_UNUSED,
tree exp ATTRIBUTE_UNUSED)
{
- /* When optimzing for size, don't use sibcalls in non-leaf routines */
+ /* Don't use sibcalls when use save-restore routine. */
if (TARGET_SAVE_RESTORE)
- return riscv_leaf_function_p ();
+ return false;
return true;
}