From bf877a7649b686fd19a4384c137357a0ca697931 Mon Sep 17 00:00:00 2001 From: "J\"orn Rennecke" Date: Mon, 5 Sep 2005 16:45:20 +0000 Subject: [PATCH] rtl.h (gen_frame_mem, [...]): Declare. * rtl.h (gen_frame_mem, gen_tmp_stack_mem): Declare. * emit-rtl.c (gen_frame_mem, gen_tmp_stack_mem): New functions. * builtins.c (expand_builtin_return_addr): Use gen_frame_mem. From-SVN: r103917 --- gcc/ChangeLog | 12 ++++++------ gcc/builtins.c | 6 ++---- gcc/emit-rtl.c | 25 +++++++++++++++++++++++++ gcc/rtl.h | 2 ++ 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 53a36c84599..15f810ded00 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-09-05 J"orn Rennecke + + * rtl.h (gen_frame_mem, gen_tmp_stack_mem): Declare. + * emit-rtl.c (gen_frame_mem, gen_tmp_stack_mem): New functions. + * builtins.c (expand_builtin_return_addr): Use gen_frame_mem. + 2005-09-05 J"orn Rennecke PR target/23683 @@ -39,12 +45,6 @@ * config/arm/arm.c (arm_legitimize_address): Limit the value passed to bit_count to 32 bits. -2005-09-02 J"orn Rennecke - - * rtl.h (gen_frame_mem, gen_tmp_stack_mem): Declare. - * emit-rtl.c (gen_frame_mem, gen_tmp_stack_mem): New functions. - * builtins.c (expand_builtin_return_addr): Use gen_frame_mem. - 2005-08-31 Mark Mitchell PR c++/23167 diff --git a/gcc/builtins.c b/gcc/builtins.c index da8c1d41c7e..246bcaa8d2b 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -529,8 +529,7 @@ expand_builtin_return_addr (enum built_in_function fndecl_code, int count) tem = DYNAMIC_CHAIN_ADDRESS (tem); #endif tem = memory_address (Pmode, tem); - tem = gen_rtx_MEM (Pmode, tem); - set_mem_alias_set (tem, get_frame_alias_set ()); + tem = gen_frame_mem (Pmode, tem); tem = copy_to_reg (tem); } @@ -545,8 +544,7 @@ expand_builtin_return_addr (enum built_in_function fndecl_code, int count) #else tem = memory_address (Pmode, plus_constant (tem, GET_MODE_SIZE (Pmode))); - tem = gen_rtx_MEM (Pmode, tem); - set_mem_alias_set (tem, get_frame_alias_set ()); + tem = gen_frame_mem (Pmode, tem); #endif return tem; } diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index d9e253e3ce2..53bff455054 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -607,6 +607,31 @@ gen_const_mem (enum machine_mode mode, rtx addr) return mem; } +/* Generate a MEM referring to fixed portions of the frame, e.g., register + save areas. */ + +rtx +gen_frame_mem (enum machine_mode mode, rtx addr) +{ + rtx mem = gen_rtx_MEM (mode, addr); + MEM_NOTRAP_P (mem) = 1; + set_mem_alias_set (mem, get_frame_alias_set ()); + return mem; +} + +/* Generate a MEM referring to a temporary use of the stack, not part + of the fixed stack frame. For example, something which is pushed + by a target splitter. */ +rtx +gen_tmp_stack_mem (enum machine_mode mode, rtx addr) +{ + rtx mem = gen_rtx_MEM (mode, addr); + MEM_NOTRAP_P (mem) = 1; + if (!current_function_calls_alloca) + set_mem_alias_set (mem, get_frame_alias_set ()); + return mem; +} + /* We want to create (subreg:OMODE (obj:IMODE) OFFSET). Return true if this construct would be valid, and false otherwise. */ diff --git a/gcc/rtl.h b/gcc/rtl.h index 7fa8fabc7d4..1692033e491 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1964,6 +1964,8 @@ extern rtx delete_insn_and_edges (rtx); extern void delete_insn_chain_and_edges (rtx, rtx); extern rtx gen_lowpart_SUBREG (enum machine_mode, rtx); extern rtx gen_const_mem (enum machine_mode, rtx); +extern rtx gen_frame_mem (enum machine_mode, rtx); +extern rtx gen_tmp_stack_mem (enum machine_mode, rtx); extern bool validate_subreg (enum machine_mode, enum machine_mode, rtx, unsigned int);