numba / llvmlite

A lightweight LLVM python binding for writing JIT compilers
https://llvmlite.pydata.org/
BSD 2-Clause "Simplified" License
1.92k stars 316 forks source link

combine Custom FFI functions with llvmlite #683

Open dbwodlf3 opened 3 years ago

dbwodlf3 commented 3 years ago

i think llvmlite are not flexible to accept custom ffi functions...

llvmlite use LLVMModuleRef and LLVMValueRef.

but llvmlite python binding class init method are using extra inputs and there are not a way to create just only one LLVMModuleRef ptr or LLVMValueRef ptr.

class ValueRef(ffi.ObjectRef):
    """A weak reference to a LLVM value.
    """
    def __init__(self, ptr, kind, parents):
        self._kind = kind
        self._parents = parents
        ffi.ObjectRef.__init__(self, ptr)

in here, i think parameters kind and parents can be removed.

class ModuleRef(ffi.ObjectRef):
    """
    A reference to a LLVM module.
    """

    def __init__(self, module_ptr, context):
        super(ModuleRef, self).__init__(module_ptr)
        self._context = context

and also here, i think the parameter context can be removed.

I think If the parameters are removed, it is better.

advancedwebdeveloper commented 3 years ago

And what about https://github.com/aguinet/dragonffi ?

dbwodlf3 commented 3 years ago

oh.. looks really good. but the purpose is different..

esc commented 3 years ago

@dbwodlf3 thank you for submitting this, I have added it to the queue for review.