> here is updated patch that assumes by default that RTL SYMBOL_REFs may overlap
> in arbitrary way and only disambiguate refs with declarations (same way as 
> tree
> oracle does) and the anchors.
>
> Bootstrapped/regtested ppc64-linux.
> Does it look resonable?

The logic looks ok to me FWIW.  I think it might be better (and easier
to follow) if we do the XSTR test first though.  I.e.:

  if (XSTR (x_base, 0) == XSTR (y_base, 0))
    return 1;
  if (x_decl && y_decl)
    return compare_base_decls (x_decl, y_decl);
  ...

Also:

Jan Hubicka <hubi...@ucw.cz> writes:
> +  /* If we have variable in section anchor, we can compare by offset.  */
> +  if (SYMBOL_REF_HAS_BLOCK_INFO_P (x_base)
> +      && SYMBOL_REF_HAS_BLOCK_INFO_P (y_base))
> +    {
> +      if (SYMBOL_REF_BLOCK (x_base) != SYMBOL_REF_BLOCK (y_base))
> +     return 0;
> +      if (SYMBOL_REF_BLOCK_OFFSET (x_base) == SYMBOL_REF_BLOCK_OFFSET 
> (y_base))
> +     return binds_def ? 1 : -1;
> +      /* Mixing anchors and non-anchors may result to false negative.
> +      We probably never do that.  */
> +      gcc_assert (SYMBOL_REF_ANCHOR_P (x_base) == SYMBOL_REF_ANCHOR_P 
> (y_base));

...although that's the usual case, I don't think there's any practical
way of enforcing an absolute guarantee.  I think instead we should just
return -1 if either symbol is not an anchor.

Nit, but: there were a couple of 'return false's that I think
should be 'return 0's.

Thanks,
Richard

Reply via email to