summaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-24 08:31:36 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-24 08:31:36 +0000
commitbe5097d8fd36a394a8e30edb63263525c1efcbbd (patch)
tree85eda9fd606f02112ed55c3f9d9703201269055d /gcc/function.c
parent494ec3edbf11a155bc68e96fecade27302a11c94 (diff)
downloadgcc-be5097d8fd36a394a8e30edb63263525c1efcbbd.tar.gz
PR c++/7086
* c-typeck.c (c_mark_addressable): Adjust calls to put_var_into_stack. * expr.c (expand_expr): Likewise. * function.c (put_var_into_stack): Add rescan parameter. Do not call fixup_var_refs when rescan is false. (gen_mem_addressof): Likewise. (assign_parms): Adjust calls to put_var_into_stack. (setjmp_protect): Likewise. (setjmp_protect_args): Likewise. * rtl.h (gen_mem_addressof): Change prototype. * stmt.c (expand_decl): Adjust calls to put_var_into_stack. * tree.h (put_var_into_stack): Change prototype. PR c++/7086 * utils2.c: Adjust calls to put_var_into_stack. PR c++/7086 * semantics.c (genrtl_named_return_value): Adjust calls to put_var_into_stack. * typeck.c (cxx_mark_addressable): Likewise. PR c++/7086 * com.c (ffecom_sym_transform_): Adjust calls to put_var_into_stack. (ffe_mark_addressable): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64781 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 56f2eccdb07..2749c9ac504 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1304,12 +1304,16 @@ init_temp_slots ()
target_temp_slot_level = 0;
}
-/* Retroactively move an auto variable from a register to a stack slot.
- This is done when an address-reference to the variable is seen. */
+/* Retroactively move an auto variable from a register to a stack
+ slot. This is done when an address-reference to the variable is
+ seen. If RESCAN is true, all previously emitted instructions are
+ examined and modified to handle the fact that DECL is now
+ addressable. */
void
-put_var_into_stack (decl)
+put_var_into_stack (decl, rescan)
tree decl;
+ bool rescan;
{
rtx reg;
enum machine_mode promoted_mode, decl_mode;
@@ -1384,7 +1388,7 @@ put_var_into_stack (decl)
to put things in the stack for the sake of setjmp, try to keep it
in a register until we know we actually need the address. */
if (can_use_addressof)
- gen_mem_addressof (reg, decl);
+ gen_mem_addressof (reg, decl, rescan);
else
put_reg_into_stack (function, reg, TREE_TYPE (decl), promoted_mode,
decl_mode, volatilep, 0, usedp, 0);
@@ -1431,7 +1435,7 @@ put_var_into_stack (decl)
/* Prevent sharing of rtl that might lose. */
if (GET_CODE (XEXP (reg, 0)) == PLUS)
XEXP (reg, 0) = copy_rtx (XEXP (reg, 0));
- if (usedp)
+ if (usedp && rescan)
{
schedule_fixup_var_refs (function, reg, TREE_TYPE (decl),
promoted_mode, 0);
@@ -2871,15 +2875,19 @@ static int cfa_offset;
#define ARG_POINTER_CFA_OFFSET(FNDECL) FIRST_PARM_OFFSET (FNDECL)
#endif
-/* Build up a (MEM (ADDRESSOF (REG))) rtx for a register REG that just had its
- address taken. DECL is the decl or SAVE_EXPR for the object stored in the
- register, for later use if we do need to force REG into the stack. REG is
- overwritten by the MEM like in put_reg_into_stack. */
+/* Build up a (MEM (ADDRESSOF (REG))) rtx for a register REG that just
+ had its address taken. DECL is the decl or SAVE_EXPR for the
+ object stored in the register, for later use if we do need to force
+ REG into the stack. REG is overwritten by the MEM like in
+ put_reg_into_stack. RESCAN is true if previously emitted
+ instructions must be rescanned and modified now that the REG has
+ been transformed. */
rtx
-gen_mem_addressof (reg, decl)
+gen_mem_addressof (reg, decl, rescan)
rtx reg;
tree decl;
+ bool rescan;
{
rtx r = gen_rtx_ADDRESSOF (Pmode, gen_reg_rtx (GET_MODE (reg)),
REGNO (reg), decl);
@@ -2917,10 +2925,11 @@ gen_mem_addressof (reg, decl)
if (DECL_P (decl) && decl_rtl == reg)
SET_DECL_RTL (decl, reg);
- if (TREE_USED (decl) || (DECL_P (decl) && DECL_INITIAL (decl) != 0))
+ if (rescan
+ && (TREE_USED (decl) || (DECL_P (decl) && DECL_INITIAL (decl) != 0)))
fixup_var_refs (reg, GET_MODE (reg), TREE_UNSIGNED (type), reg, 0);
}
- else
+ else if (rescan)
fixup_var_refs (reg, GET_MODE (reg), 0, reg, 0);
return reg;
@@ -4984,7 +4993,7 @@ assign_parms (fndecl)
stack. So, we go back to that sequence, just so that
the fixups will happen. */
push_to_sequence (conversion_insns);
- put_var_into_stack (parm);
+ put_var_into_stack (parm, /*rescan=*/true);
conversion_insns = get_insns ();
end_sequence ();
}
@@ -5513,7 +5522,7 @@ setjmp_protect (block)
||
#endif
! DECL_REGISTER (decl)))
- put_var_into_stack (decl);
+ put_var_into_stack (decl, /*rescan=*/true);
for (sub = BLOCK_SUBBLOCKS (block); sub; sub = TREE_CHAIN (sub))
setjmp_protect (sub);
}
@@ -5540,7 +5549,7 @@ setjmp_protect_args ()
||
#endif
! DECL_REGISTER (decl)))
- put_var_into_stack (decl);
+ put_var_into_stack (decl, /*rescan=*/true);
}
/* Return the context-pointer register corresponding to DECL,