[llvm-commits] [llvm] r77706 - in /llvm/trunk: include/llvm/Support/Annotation.h lib/Support/Annotation.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Mon Aug 3 10:05:25 PDT 2009


Hi Chris,

Chris Lattner wrote:
> Hi Nicolas,
>
> Why can't you just use a std::map or DenseMap on the side?  Trying to  
> actually *attach* data to LLVM IR objects is a really fragile thing to  
> try to do. 

Yes, that's what I fear :(

>  If the entire rest of the compiler can get away without  
> it, I don't see why vmkit needs to do it.
>   

I can surely use maps for that. My problem is that (a) I haven't coded a 
map implementation where I can control the allocations, and that's very 
important for the runtime. DenseMap and std::map have their own malloc 
allocators (the allocator in stl isn't usable). Using annotations and 
subclassing were easier solutions, timely speaking. And (b) I can't 
avoid a global map, and I hate global maps (needs locking and a global 
allocator). When llvm wants vmkit to materialize a llvm::function, I 
have no way of knowing what is the context of this function. For 
example, a context in Java is a class loader. By being able to attach 
this "context" to annotations or subclasses, there was no need of the 
global map.

Nicolas

> -Chris
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>   




More information about the llvm-commits mailing list