[LLVMdev] RFC: Constant Creation API

Nicolas Geoffray nicolas.geoffray at lip6.fr
Tue Jul 28 10:17:57 PDT 2009

Owen Anderson wrote:
> 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. 

The goal is to remove all constants created during IR creation of a 
function, once the function has been JITted. For example, after the 
function has been JIIted, I can call llvm::Function->deleteBody, that 
will delete the instructions in the function. But all llvm::Constants 
created by the function will remain in memory. If I could attach a 
LLVMContext per function to create the constants, I would be able to 
delete all constants created for the function's body by deleting the 

Does that make sense?

I know that this disables any IPO, but I'm currently more interested 
into memory savings than optimizations.


More information about the llvm-dev mailing list