This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: VTA RTL patch review?


On Jul 30, 2009, Richard Henderson <rth@redhat.com> wrote:

> On 07/23/2009 12:56 PM, Alexandre Oliva wrote:
>> +  /* INSN_UID for next debug insn emitted.  Only used if
>> +     -fmin-debug-insn-uid=<value> is given with nonzero value.  */
>> +  int x_cur_debug_insn_uid;

> Update comment to match change to params.

ACK

>> emit_insn_after (rtx pattern, rtx after)
>> {
>> -  if (INSN_P (after))
>> -    return emit_insn_after_setloc (pattern, after, INSN_LOCATOR (after));
>> +  rtx prev = after;
>> +
>> +  while (DEBUG_INSN_P (prev))
>> +    prev = PREV_INSN (prev);
>> +
>> +  if (INSN_P (prev))
> ....
>> emit_insn_before (rtx pattern, rtx before)
>> {
>> -  if (INSN_P (before))
>> -    return emit_insn_before_setloc (pattern, before, INSN_LOCATOR (before));
>> +  rtx next = before;
>> +
>> +  while (DEBUG_INSN_P (next))
>> +    next = PREV_INSN (next);
>> +
>> +  if (INSN_P (next))

> Do debug insns "belong" to the preceeding or following real insn?

Neither.

> I would have thought insert-after would search backward and
> insert-before would not search, or vice-versa, rather than
> this situation in which both inserts search backward.

The idea here is to ensure we get the same result with debug insns that
we'd have got without them.

If the debug insn wasn't there, emit_insn_after would have got the
previous non-debug insn, and emit_insn_before would have got the next
non-debug insn as argument.  So both have to search in the opposite
direction as that of insertion.

> It might be nice to have helper functions like

> static inline rtx
> adjust_after_position_for_debug (rtx prev)
> {
>   ...
>   return prev;
> }

> and use that in the 5 places that seem to be required.

Erhm...  I don't quite follow what you're suggesting.  Maybe it's based
on the misunderstanding above?

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]