summaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-18 22:39:23 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-18 22:39:23 +0000
commit33b4151e192552f7de1f9b9bad32e3fc45d48efb (patch)
treeb8a2291cd0a9b39efe82cabad278ef627235fda0 /gcc/function.c
parentf707dbf28259fca800a0274be2156b98dfafb4ba (diff)
downloadgcc-33b4151e192552f7de1f9b9bad32e3fc45d48efb.tar.gz
* function.c (purge_addressof_1): For ADDRESSOF, see if SUB is a
hard or virtual register and copy into pseudo if replacement fails. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65798 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 699fd21e6d4..b75a07e15a6 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -3052,7 +3052,15 @@ purge_addressof_1 (loc, insn, force, store, may_postpone, ht)
return true;
start_sequence ();
- sub = force_operand (sub, NULL_RTX);
+
+ /* If SUB is a or virtual register, try it as a pseudo-register.
+ Otherwise, perhaps SUB is an expression, so generate code to compute
+ it. */
+ if (GET_CODE (sub) == REG && REGNO (sub) <= LAST_VIRTUAL_REGISTER)
+ sub = copy_to_reg (sub);
+ else
+ sub = force_operand (sub, NULL_RTX);
+
if (! validate_change (insn, loc, sub, 0)
&& ! validate_replace_rtx (x, sub, insn))
abort ();