[llvm-commits] [cfe-commits] TableGen backend API refactoring review request

Chandler Carruth chandlerc at google.com
Wed Jun 20 23:28:42 PDT 2012


On Wed, Jun 20, 2012 at 11:23 PM, Sean Silva <silvas at purdue.edu> wrote:

> Wow that got incredibly mangled somehow. it was meant to say:
>
> "Thank you Jakob for patiently walking me through my first non-trivial
> patch set! I'll see what I can do to ensure deterministic iteration order.
> "
>
> I'm still looking for a way to ensure deterministic iteration order
> without making a mess of the code, such as just blindly adding a special
> comparator to each of containers keyed on pointers; that would just make
> the code more muddled (even in cases where the container isn't being
> iterated over). There are also a couple hash tables that are keyed on
> Record*'s, which I think can be changed but I'm not familiar enough with
> the hash traits that they use. Any ideas for a good way to migrate to
> stable iteration interfaces? Thankfully, each Record has a field `unsigned
> ID;` which uniquely identifies it, so redirecting any hash/compare to that
> should be safe.
>

I think introducing similar ID fields which are stable is the best strategy.

In particular, I like to dump the hashtable to a vector, and then sort on
the stable key.

If you're lacking one of them, a common easy way to synthesize such an ID
is to track order-of-allocation in the ID variable using a global atomic
counter of some form.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120620/596e38f2/attachment.html>


More information about the llvm-commits mailing list