[LLVMdev] RFC: Constant Creation API

Owen Anderson resistor at mac.com
Tue Jul 28 09:10:10 PDT 2009


Nicholas,

> What if I want to have global llvm::Type's, that can be used by many
> LLVMContext's. For example, I'd like to have one LLVMContext per
> function, and  be able to create constants that belong to the context
> but using a global, shared amongst LLVMContext's, llvm::Type.
>
> I know that's not doable right now, but aren't we losing this
> possibility if we move back to the old static functions?

That wasn't going to be possible with the methods-on-LLVMContext  
either.  The Type uniquing tables will be moving onto the context for  
similar reasons to the Constant ones, though we will make an effort to  
preserve the existing APIs.

I'm not sure I understand your goal with having one context per  
function.  In general, each Module can have its own context, but  
functions within the same module need to have the same one, so that  
function types compare correctly, and so that constants in globals  
work properly.  Trying to get around this is likely to cause screwy  
results, as things that should compare as equal won't.

Hope that helps,

--Owen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090728/55b4d747/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090728/55b4d747/attachment.bin>


More information about the llvm-dev mailing list