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: [PATCH] Sign extension elimination


> Sorry for the *long* time it took me to respond to your note.
> I suddenly remembered that I wanted to respond but it slipped
> my mined.
> 
> You are right that our problem could have been solved this way,
> but the reason that I made this *extra_info flag is that the
> problem is general and doesn't concern only the sign_extension
> optimization.

Yes, but that doesn't affect the suggestion.

> In the web optimization there is an implementation of a
> union-find data structure, but it wasn't general enough.
> In many cases, when a union-find data structure is being used
> there is a need to attach more information to each node and
> to update this information when two nodes are being connected.

Right, and you can attach information to each node in the manner i
suggested, and still have it updated when the nodes are being connected
(that is why you have a function pointer).
Again, this avoids wasting a pointer in the structure for people who
*don't* need it.

In effect, it's like subclassing the union-find datastructure would be
in C++.



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