Message ID | 87oaz5z8w5.fsf@talisman.default |
---|---|
State | New |
Headers | show |
On 05/10/14 14:16, Richard Sandiford wrote: > SCRATCH has a single "0" field because reload used to turn it directly > into a REG. It no longer does (or could do) that since REG has three > fields rather than one. This patch therefore updates the comment and > removes the field. > > Tested on x86_64-linux-gnu. OK to install? > > Thanks, > Richard > > > gcc/ > * rtl.def (scratch): Fix outdated comment and remove "0" field. > * gengtype.c (adjust_field_rtx_def): Update accordingly. Are you sure reload doesn't still do this? Do you have a pointer to when this code was removed? While I would have expected something to break, perhaps the problems are just latent. If you had a pointer which showed this code in reload being removed, I'd approve without hesitation. Jeff
Jeff Law <law@redhat.com> writes: > On 05/10/14 14:16, Richard Sandiford wrote: >> SCRATCH has a single "0" field because reload used to turn it directly >> into a REG. It no longer does (or could do) that since REG has three >> fields rather than one. This patch therefore updates the comment and >> removes the field. >> >> Tested on x86_64-linux-gnu. OK to install? >> >> Thanks, >> Richard >> >> >> gcc/ >> * rtl.def (scratch): Fix outdated comment and remove "0" field. >> * gengtype.c (adjust_field_rtx_def): Update accordingly. > Are you sure reload doesn't still do this? Do you have a pointer to > when this code was removed? The rtl.def SCRATCH entry predates the repository (1991) and I couldn't see anything in the initial versions of reload.c or reload1.c that set the code to a REG. local-alloc.c had: if (qty_scratch_rtx[q]) { if (GET_CODE (qty_scratch_rtx[q]) == REG) abort (); PUT_CODE (qty_scratch_rtx[q], REG); REGNO (qty_scratch_rtx[q]) = qty_phys_reg[q]; but that was removed by: Wed Oct 22 00:34:12 1997 Jeffrey A Law (law@cygnus.com) * local-alloc.c (block_alloc): Don't lose if two SCRATCH expressions are shared. (Disappointed that you don't remember what you did in 97. :-)) I couldn't see anything in global.c that would set the code to a REG. No current calls to PUT_CODE would do that either. REG became bigger than SCRATCH with: Thu Jun 25 15:08:16 1998 Mark Mitchell <mark@markmitchell.com> * invoke.texi (-fstrict-aliasing): Document. * rtl.texi (MEM_ALIAS_SET): Document. Thanks, Richard
On 05/12/14 10:37, Richard Sandiford wrote: > The rtl.def SCRATCH entry predates the repository (1991) and I couldn't > see anything in the initial versions of reload.c or reload1.c that set > the code to a REG. local-alloc.c had: > > if (qty_scratch_rtx[q]) > { > if (GET_CODE (qty_scratch_rtx[q]) == REG) > abort (); > PUT_CODE (qty_scratch_rtx[q], REG); > REGNO (qty_scratch_rtx[q]) = qty_phys_reg[q]; > > but that was removed by: > > Wed Oct 22 00:34:12 1997 Jeffrey A Law (law@cygnus.com) > > * local-alloc.c (block_alloc): Don't lose if two SCRATCH expressions > are shared. > > (Disappointed that you don't remember what you did in 97. :-)) :-) '97 to '99 were, umm, busy. > > I couldn't see anything in global.c that would set the code to a REG. > No current calls to PUT_CODE would do that either. > > REG became bigger than SCRATCH with: > > Thu Jun 25 15:08:16 1998 Mark Mitchell <mark@markmitchell.com> > > * invoke.texi (-fstrict-aliasing): Document. > * rtl.texi (MEM_ALIAS_SET): Document. OK. Concerns addressed. Go ahead with the change. Thanks for the detective work! :-) jeff
Index: gcc/rtl.def =================================================================== --- gcc/rtl.def 2014-05-10 21:13:03.383968475 +0100 +++ gcc/rtl.def 2014-05-10 21:13:06.240993266 +0100 @@ -384,11 +384,10 @@ DEF_RTL_EXPR(PC, "pc", "", RTX_OBJ) DEF_RTL_EXPR(REG, "reg", "i0", RTX_OBJ) /* A scratch register. This represents a register used only within a - single insn. It will be turned into a REG during register allocation + single insn. It will be replaced by a REG during register allocation or reload unless the constraint indicates that the register won't be - needed, in which case it can remain a SCRATCH. This code is - marked as having one operand so it can be turned into a REG. */ -DEF_RTL_EXPR(SCRATCH, "scratch", "0", RTX_OBJ) + needed, in which case it can remain a SCRATCH. */ +DEF_RTL_EXPR(SCRATCH, "scratch", "", RTX_OBJ) /* A reference to a part of another value. The first operand is the complete value and the second is the byte offset of the selected part. */ Index: gcc/gengtype.c =================================================================== --- gcc/gengtype.c 2014-05-10 21:13:03.381968458 +0100 +++ gcc/gengtype.c 2014-05-10 21:13:06.242993283 +0100 @@ -1249,8 +1249,6 @@ adjust_field_rtx_def (type_p t, options_ t = tree_tp, subname = "rt_tree"; else if (i == REG && aindex == 1) t = reg_attrs_tp, subname = "rt_reg"; - else if (i == SCRATCH && aindex == 0) - t = scalar_tp, subname = "rt_int"; else if (i == SYMBOL_REF && aindex == 1) t = scalar_tp, subname = "rt_int"; else if (i == SYMBOL_REF && aindex == 2)