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>
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.OK.> > 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 LLVMContext. Does that make sense? I know that this disables any IPO, but I'm currently more interested into memory savings than optimizations. Nicolas
On Jul 28, 2009, at 10:17 AM, Nicolas Geoffray wrote:> 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 > LLVMContext. > > Does that make sense?It makes sense, but it sounds like risky business. Good luck with it! ;-) --Owen
Maybe Matching Threads
- [LLVMdev] RFC: Constant Creation API
- [LLVMdev] Memory clean for applications using LLVM for JIT compilation
- [LLVMdev] Memory clean for applications using LLVM for JIT compilation
- [LLVMdev] RFC: Constant Creation API
- [LLVMdev] RFC: Constant Creation API[MESSAGE NOT SCANNED]