[LLVMdev] [proposal] Extensible IR metadata

David Greene dag at cray.com
Fri Sep 11 17:57:59 PDT 2009


On Friday 11 September 2009 19:15, Jeffrey Yasskin wrote:

> This relies on the compiler uniquing static member variables across
> translation units, and I've never tested that across shared library
> boundaries.  The initializer didn't work with gcc-2 (there was a
> workaround), but I believe it works with gcc-4. I've never tested it
> with MSVC. We can also use static local variables, which would have a
> different set of bugs, but they're very slightly slower to access.

Shared libraries are the big problem.  I know the Boost guys had endless 
discussions about how to design a Singleton to work in the presence of shared 
libraries and this is pretty close to the same problem.

> Since there's a registration step, we could also use Pass-style IDs,
> and have the registration fill them in, which would avoid uniquing
> problems.

Yes, I think that should work.  Doing things with static initializer magic is 
asking for trouble.

                                 -Dave



More information about the llvm-dev mailing list