[LLVMdev] MAJOR API CHANGE: LLVMContext

John Criswell criswell at cs.uiuc.edu
Wed Jul 8 07:57:43 PDT 2009


Owen Anderson wrote:
> Notice of a major upcoming API change:  The static methods for  
> constructing types and constants will be going away in the future.   
> Instead, the global uniquing tables that lurk behind these APIs will  
> be privatized within LLVMContext instances.
>
> What this means for you:  Your client application will need to create  
> an LLVMContext in main(), and pass it into a few APIs (the constructor  
> for Module, for instance).  You can, in theory, have more than one  
> LLVMContext as long as you never want Modules created under separate  
> contexts to interact.
>
> In the near term, I will be committing patches to do this conversion  
> for the existing LLVM tools, including Clang and LLVM-GCC, which  
> should provide examples for those following along at home.
>   
Can you give a brief example of where to find the LLVMContext within a
ModulePass or FunctionPass?  Is this just the context stored within the
Module or Function passed to runOnModule/runOnFunction?

If the above is true, then does the GlobalVariable constructor need to
take a Context argument?  It seems it should be able to infer it from
the Module argument.

-- John T.

> --Owen
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>   




More information about the llvm-dev mailing list