Re: [PATCH 2/2] refactor emit_*_{after,before}{,_setloc} using common functions

2011-03-24 Thread Richard Henderson
On 03/23/2011 02:40 PM, Nathan Froyd wrote: > I can look into just how many places might need to be fixed up because > of this, but scattering a bunch of ifs all over the place seemed less > elegant than handling it all in the emit* functions. Yeah, maybe. On the other hand, the other complicatio

Re: [PATCH 2/2] refactor emit_*_{after,before}{,_setloc} using common functions

2011-03-23 Thread Nathan Froyd
On Wed, Mar 23, 2011 at 01:55:34PM -0700, Richard Henderson wrote: > I can't see how emitting a NULL_RTX should be a Good Thing, ever, > and thus I don't see why we should be doing special things to > handle it. Ah, I thought the same thing and gcc_assert'ed emitting a NULL_RTX. I didn't get ver

Re: [PATCH 2/2] refactor emit_*_{after,before}{,_setloc} using common functions

2011-03-23 Thread Richard Henderson
On 03/23/2011 01:17 PM, Nathan Froyd wrote: > * emit-rtl.c (emit_pattern_after_setloc): New function. > (emit_insn_after_setloc, emit_jump_insn_after_setloc): Call it. > (emit_call_insn_after_setloc, emit_debug_insn_after_setloc): Likewise. > (emit_pattern_after): New functi

Re: [PATCH 2/2] refactor emit_*_{after,before}{,_setloc} using common functions

2011-03-23 Thread Nathan Froyd
On Wed, Mar 23, 2011 at 11:36:26AM -0700, Richard Henderson wrote: > On 03/23/2011 05:09 AM, Nathan Froyd wrote: > > Did you mean loc == UNKNOWN_LOCATION? Also, it looks like that's > > conflating INSN_LOCATORs and location_ts; it seems like it'd be better > > to keep them separate. > > Ug. Yes

Re: [PATCH 2/2] refactor emit_*_{after,before}{,_setloc} using common functions

2011-03-23 Thread Richard Henderson
On 03/23/2011 05:09 AM, Nathan Froyd wrote: > Did you mean loc == UNKNOWN_LOCATION? Also, it looks like that's > conflating INSN_LOCATORs and location_ts; it seems like it'd be better > to keep them separate. Ug. Yes and yes. I'd forgotten that insn_locators are different from line locations.

Re: [PATCH 2/2] refactor emit_*_{after,before}{,_setloc} using common functions

2011-03-23 Thread Nathan Froyd
On Tue, Mar 22, 2011 at 05:06:39PM -0700, Richard Henderson wrote: > On 03/22/2011 04:13 PM, Nathan Froyd wrote: > > rtx > > emit_call_insn_before_setloc (rtx pattern, rtx before, int loc) > > { > > ... > > if (pattern == NULL_RTX) > > return last; > > > > first = NEXT_INSN (first); > >

Re: [PATCH 2/2] refactor emit_*_{after,before}{,_setloc} using common functions

2011-03-22 Thread Richard Henderson
On 03/22/2011 04:13 PM, Nathan Froyd wrote: > rtx > emit_call_insn_before_setloc (rtx pattern, rtx before, int loc) > { > ... > if (pattern == NULL_RTX) > return last; > > first = NEXT_INSN (first); > > The jump_insn and debug_insn variants have identical behavior to > call_insn. AFAIC

Re: [PATCH 2/2] refactor emit_*_{after,before}{,_setloc} using common functions

2011-03-22 Thread Nathan Froyd
On Tue, Mar 22, 2011 at 02:28:30PM -0700, Richard Henderson wrote: > On 03/21/2011 08:18 PM, Nathan Froyd wrote: > > +/* Insert PATTERN before BEFORE, setting its INSN_LOCATION to LOC. > > + MAKE_RAW indicates how to turn PATTERN into a real insn. INSNP > > + indicates if PATTERN is meant for

Re: [PATCH 2/2] refactor emit_*_{after,before}{,_setloc} using common functions

2011-03-22 Thread Richard Henderson
On 03/21/2011 08:18 PM, Nathan Froyd wrote: > +/* Insert PATTERN before BEFORE, setting its INSN_LOCATION to LOC. > + MAKE_RAW indicates how to turn PATTERN into a real insn. INSNP > + indicates if PATTERN is meant for an INSN as opposed to a JUMP_INSN, > + CALL_INSN, etc. */ > + > +static

[PATCH 2/2] refactor emit_*_{after,before}{,_setloc} using common functions

2011-03-21 Thread Nathan Froyd
This patch builds on the previous one to refactor the close cousins of the *_noloc family. I attempted to separate these out into separate patches, one dealing with *_setloc and the other dealing with the remainder, but I did not trust myself to do it correctly even with magit's help. * e