Re: Execute LLVM Ir code generated from python code

0 views
Skip to first unread message
Message has been deleted

graham....@embecosm.com

unread,
Jun 13, 2017, 12:25:39 PM6/13/17
to Numba Public Discussion - Public
Assuming this is the question you have contacted me directly about - there have probably been no responses to this question because it's difficult to understand what you are asking:

- Executing LLVM IR that is generated from Python code is exactly what llvmlite and Numba do.
- Clang is a C language family front-end for LLVM - what is the connection you see to llvmlite and Numba?

If you can explain in detail what it is that you're trying to do, it might be possible to suggest what you can try/look at.

Best regards,
Graham.

On Wednesday, 7 June 2017 21:51:26 UTC+1, Samaneh Berenjian wrote:
does any one know if I can execute llvm Ir which is generated from python code? Using numba, llvm-lite we can have LLVM IR, but I am not sure if it is executable using clang or not? Has anyone experience about that?

Jason Sachs

unread,
Jun 13, 2017, 1:09:11 PM6/13/17
to numba...@continuum.io
My guess is that the OP wants to know whether the code generated by numba can also be executed outside of Python.

--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users+unsubscribe@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/10f96ef5-8fc8-4d05-902a-04677d5c7624%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Message has been deleted

graham....@embecosm.com

unread,
Jun 13, 2017, 1:49:19 PM6/13/17
to Numba Public Discussion - Public
I've not come across pyvex before, and I can't seem to find any examples of translating VEX to LLIR (either with llvmlite or using another implementation) - I suspect that there's no quick way to do what you want, and you'd have to produce a translator that takes VEX (or the subset that is interesting to you) and uses llvmlite to build the IR all yourself. The llvmlite IR layer is what you'd want to use: https://llvmlite.readthedocs.io/en/latest/ir/index.html - there is a minimal example to get started with this at: https://llvmlite.readthedocs.io/en/latest/ir/examples.html

If you want to execute code you build with the IR layer, you can use the binding layer: https://llvmlite.readthedocs.io/en/latest/binding/index.html

As llvmlite's primary driver for development has been Numba, you might also find that it doesn't implement everything that you'd need to easily translate VEX to LLIR. If this is the case, you might have to extend llvmlite, either by adding more to the IR layer to replicate things you can do to build IR with LLVM, or to add more bindings to LLVM functions in the binding layer. There's a distinction between these two layers because the IR layer is a Python reimplementation of the LLVM IR building functions, which then generates a textual representation of the IR - this is usually then fed to the binding layer, which actually makes use of the LLVM library that it is linked to.


Best regards,
Graham.

On Tuesday, 13 June 2017 18:12:50 UTC+1, Samaneh Berenjian wrote:
Thank you for the  reply. Actually, I am using pyvex and it provides VEXIr. Using llvmlite, I want to use the same functions and statements of pyvex in form of llvmlite and produce LLVMIR. However, the output should be executable (I should be able to compile the LLVM IR and do optimization on it 9for example using by lli output.ll). My other question is that,  how can i for example write the following statements in llvmlite and then I will have a generated llvm IR?

for stmt in irsb.statements:
    if isinstance(stmt, pyvex.IRStmt.IMark):
        print "------ IMark(0x%x, %d, %d) ------" % (stmt.addr, stmt.len, stmt.delta)
?
Look forward to here from you soon



--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.

To post to this group, send email to numba...@continuum.io.



--
Best Regards
Samaneh Berenjian

Samaneh Berenjian

unread,
Jun 13, 2017, 4:09:13 PM6/13/17
to numba...@continuum.io
Thank you for your kind reply. I am planning to provide some forms of IR and bind it for execution. My other question is that, how can I print a special character for a statement in llvm IR?

To unsubscribe from this group and stop receiving emails from it, send an email to numba-users+unsubscribe@continuum.io.

To post to this group, send email to numba...@continuum.io.
Reply all
Reply to author
Forward
0 new messages