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: [trunk<-vta] Re: [vta] fix PCH testsuite regression with DW_AT_MIPS_linkage_name


On Jun  2, 2009, Richard Henderson <rth@redhat.com> wrote:

> Alexandre Oliva wrote:
>> +  while (--ix)
>> +    {
>> +      prev = VEC_index (dw_attr_node, die->die_attr, ix - 1);
>> +
>> +      if (prev->dw_attr == DW_AT_decl_line || prev->dw_attr == DW_AT_name)
>> +	{
>> +	  VEC_replace (dw_attr_node, die->die_attr, ix, &linkage);
>> +	  return;
>> +	}
>> +      else
>> +	VEC_replace (dw_attr_node, die->die_attr, ix, prev);
>> +    }

> Mostly ok.  But really I'd prefer to see this loop merely
> search, then use VEC_pop and VEC_quick_insert to move the
> entry.

Like this?

static inline void
move_linkage_attr (dw_die_ref die)
{
  unsigned ix = VEC_length (dw_attr_node, die->die_attr);
  dw_attr_node linkage = *VEC_index (dw_attr_node, die->die_attr, ix - 1);

  gcc_assert (linkage.dw_attr == DW_AT_MIPS_linkage_name);

  while (--ix > 0)
    {
      dw_attr_node *prev = VEC_index (dw_attr_node, die->die_attr, ix - 1);

      if (prev->dw_attr == DW_AT_decl_line || prev->dw_attr == DW_AT_name)
	break;
    }

  if (ix != VEC_length (dw_attr_node, die->die_attr) - 1)
    {
      VEC_pop (dw_attr_node, die->die_attr);
      VEC_quick_insert (dw_attr_node, die->die_attr, ix, &linkage);
    }
}


-- 
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]