search for: llvmgetglobalpar

Displaying 5 results from an estimated 5 matches for "llvmgetglobalpar".

2008 May 12
0
[LLVMdev] Python bindings available.
...ership of the Module.) I presume that your Python object is under the impression it owns the Module; when that goes out of scope, its refcount goes to zero and it invokes its dtor, disposing of the Module. D'oh— now the ModuleProvider has a dangling pointer. :) The routine LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global); poses a related problem; in this case, the returned reference is non-owning, so you must not dtor it from Python. The fix, of course, is providing a dispose routine and requiring the user to call it, since you can't know what they've done with the pointer....
2008 May 12
2
[LLVMdev] Python bindings available.
...es that are attached to MPs, or 2b) Do not do anything in the dtors of MPs (while letting the dtor of modules do the work) Both options have the disadvantage of assuming the C/C++ implementation (like MP::dtor deletes only the module and nothing else). > The routine LLVMModuleRef > LLVMGetGlobalParent(LLVMValueRef Global); poses a related problem; in this > case, the returned reference is non-owning, so you must not dtor it from > Python. If I do this: m1 = Module.new() g1 = m1.add_global_variable(ty, "name") m2 = g1.module will the LLVMModuleRef pointer returned in t...
2008 May 12
0
[LLVMdev] Python bindings available.
...t; modules do the work) The ModuleProvider itself also needs to be destroyed or you have a memory leak. > Both options have the disadvantage of assuming the C/C++ > implementation (like MP::dtor deletes only the module and nothing > else). > >> The routine LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global); >> poses a related problem; in this case, the returned reference is >> non-owning, so you must not dtor it from Python. > > If I do this: > > m1 = Module.new() > g1 = m1.add_global_variable(ty, "name") > m2 = g1.module > &gt...
2008 May 10
4
[LLVMdev] Python bindings available.
Hi all, I'd like to announce the availability of Python bindings for LLVM. It is built over llvm-c, and currently exposes enough APIs to build an in-memory IR (and dump it!). It needs LLVM 2.3 latest and Python 2.5 (2.4 should be sufficient, but I haven't tested). Tested only on Linux/i386. Would love to hear your comments. [Needless to say, it's all work in progress, but mostly it
2008 May 12
2
[LLVMdev] Python bindings available.
...rovider itself also needs to be destroyed or you have a > memory leak. > > > > Both options have the disadvantage of assuming the C/C++ > > implementation (like MP::dtor deletes only the module and nothing > > else). > > > >> The routine LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global); > >> poses a related problem; in this case, the returned reference is > >> non-owning, so you must not dtor it from Python. > > > > If I do this: > > > > m1 = Module.new() > > g1 = m1.add_global_variable(ty, "nam...