summaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2004-03-29 14:48:45 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2004-03-29 09:48:45 -0500
commit97955d55bbe5aab1da0427e11e740851c83e18ff (patch)
tree0267fcb37b88731de6ad0267822013c7567f8316 /gcc/function.c
parent2820d220585177ca4e2e3136bf8ff255303ba6db (diff)
downloadgcc-97955d55bbe5aab1da0427e11e740851c83e18ff.tar.gz
function.c (put_var_into_stack): If old RTL was ADDRESSOF, update the address inside the old RTL.
* function.c (put_var_into_stack): If old RTL was ADDRESSOF, update the address inside the old RTL. From-SVN: r80057
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 0972615d89f..48e2f5d79d9 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1287,7 +1287,7 @@ init_temp_slots (void)
void
put_var_into_stack (tree decl, int rescan)
{
- rtx reg;
+ rtx orig_reg, reg;
enum machine_mode promoted_mode, decl_mode;
struct function *function = 0;
tree context;
@@ -1299,9 +1299,9 @@ put_var_into_stack (tree decl, int rescan)
context = decl_function_context (decl);
/* Get the current rtl used for this object and its original mode. */
- reg = (TREE_CODE (decl) == SAVE_EXPR
- ? SAVE_EXPR_RTL (decl)
- : DECL_RTL_IF_SET (decl));
+ orig_reg = reg = (TREE_CODE (decl) == SAVE_EXPR
+ ? SAVE_EXPR_RTL (decl)
+ : DECL_RTL_IF_SET (decl));
/* No need to do anything if decl has no rtx yet
since in that case caller is setting TREE_ADDRESSABLE
@@ -1366,6 +1366,12 @@ put_var_into_stack (tree decl, int rescan)
else
put_reg_into_stack (function, reg, TREE_TYPE (decl), promoted_mode,
decl_mode, volatilep, 0, usedp, 0);
+
+ /* If this was previously a MEM but we've removed the ADDRESSOF,
+ set this address into that MEM so we always use the same
+ rtx for this variable. */
+ if (orig_reg != reg && GET_CODE (orig_reg) == MEM)
+ XEXP (orig_reg, 0) = XEXP (reg, 0);
}
else if (GET_CODE (reg) == CONCAT)
{