labels-2.c / -Os fix
Richard Henderson
rth@cygnus.com
Fri Apr 28 13:29:00 GMT 2000
On Thu, Apr 27, 2000 at 12:34:39PM +0200, Jan Hubicka wrote:
> > Seems like output_constant_def couldn't really do it's job
> > this way? Perhaps you can rely on pointer equivalence of
> > the referenced CODE_LABEL rather than on the UID?
> I was thinking about this, but I am not sure if the CODE_LABELs can't
> be garbage collected and dropped.
Certainly they can. But not when there's a valid reference to it.
> Also this would require me to figure out the CODE_LABEL pointer...
Eh? No, you misunderstand my intent. Not the address of .L3, but
literally the address of the CODE_LABEL rtx. I've checked this in.
r~
* varasm.c (record_constant_1): Record the CODE_LABEL when
taking the address of a LABEL_REF.
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/varasm.c,v
retrieving revision 1.111
diff -c -p -d -r1.111 varasm.c
*** varasm.c 2000/04/15 15:44:19 1.111
--- varasm.c 2000/04/28 20:23:46
*************** record_constant_1 (exp)
*** 2867,2875 ****
/* Record the offset. */
obstack_grow (&permanent_obstack,
(char *) &value.offset, sizeof value.offset);
! /* Record the symbol name. */
! obstack_grow (&permanent_obstack, XSTR (value.base, 0),
! strlen (XSTR (value.base, 0)) + 1);
}
return;
--- 2867,2890 ----
/* Record the offset. */
obstack_grow (&permanent_obstack,
(char *) &value.offset, sizeof value.offset);
!
! switch (GET_CODE (value.base))
! {
! case SYMBOL_REF:
! /* Record the symbol name. */
! obstack_grow (&permanent_obstack, XSTR (value.base, 0),
! strlen (XSTR (value.base, 0)) + 1);
! break;
! case LABEL_REF:
! /* Record the address of the CODE_LABEL. It may not have
! been emitted yet, so it's UID may be zero. But pointer
! identity is good enough. */
! obstack_grow (&permanent_obstack, &XEXP (value.base, 0),
! sizeof (rtx));
! break;
! default:
! abort ();
! }
}
return;
More information about the Gcc-patches
mailing list