This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
purge_addressof not purging reg-notes
- To: gcc at gcc dot gnu dot org
- Subject: purge_addressof not purging reg-notes
- From: Andrew Haley <aph at cambridge dot redhat dot com>
- Date: Fri, 22 Jun 2001 16:20:30 +0100 (BST)
- References: <15152.38584.996024.26816@cuddles.cambridge.redhat.com><20010621165326.G6022@redhat.com>
I'm getting a problem where purge_addressof is doing the wrong thing.
This is ARM, current top-of-trunk gcc.
The original insn looks like this:
(insn 955 953 957 (set (reg:SI 2 r2)
(reg:SI 179)) 177 {*arm_movsi_insn} (nil)
(expr_list:REG_EQUAL (addressof:SI (reg/v:SI 163) 162 0x84b2478)
(nil)))
And purge_addressof_1() is called on the note, which calls
put_addressof_into_stack() with
(addressof:SI (reg/v:SI 163) 162 0x84b2478)
which returns
(addressof:SI (mem/f:SI (plus:SI (reg/f:SI 25 sfp)
(const_int -8336 [0xffffdf70])) 8) 162 0x84b2478)
leaving the insn like this:
(insn 955 953 957 (set (reg:SI 2 r2)
(reg:SI 179)) 177 {*arm_movsi_insn} (nil)
(expr_list:REG_EQUAL (addressof:SI (mem/f:SI (plus:SI (reg/f:SI 25 sfp)
(const_int -8336 [0xffffdf70])) 8) 162 0x84b2478)
(nil)))
So, it has put the reg into the stack but it's left the addressof.
I've added a little code to fixup_var_refs_insn() so that it nukes any
notes that contain ADDRESSOFs. This is easier than trying to repair
them.
Is this OK?
Andrew.
2001-06-22 Andrew Haley <aph@cambridge.redhat.com>
* function.c (fixup_var_refs_insn): Remove any ADDRESSOFs from an
insn's notes.
(is_addressof): Robustify: allow NULL rtxes.
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.276
diff -c -2 -p -r1.276 function.c
*** function.c 2001/06/15 22:08:42 1.276
--- function.c 2001/06/22 15:11:29
*************** fixup_var_refs_insn (insn, var, promoted
*** 1873,1879 ****
{
if (GET_CODE (note) != INSN_LIST)
! XEXP (note, 0)
! = walk_fixup_memory_subreg (XEXP (note, 0), insn, 1);
! note = XEXP (note, 1);
}
}
--- 1873,1887 ----
{
if (GET_CODE (note) != INSN_LIST)
! {
! XEXP (note, 0)
! = walk_fixup_memory_subreg (XEXP (note, 0), insn, 1);
!
! /* We may have an (addressof (mem)) where mem used to be a
! pseudo in reg-notes. Remove it now. */
! if (for_each_rtx (¬e, is_addressof, NULL))
! remove_note (insn, note);
!
! note = XEXP (note, 1);
! }
}
}
*************** is_addressof (rtl, data)
*** 3353,3357 ****
void *data ATTRIBUTE_UNUSED;
{
! return GET_CODE (*rtl) == ADDRESSOF;
}
--- 3361,3365 ----
void *data ATTRIBUTE_UNUSED;
{
! return *rtl && GET_CODE (*rtl) == ADDRESSOF;
}