5 ms·
CodeGen: LLVM wrapper for just-in-time code generation and compilation
- saagarjha 7y agoRelated is cling, the C++ “interpreter”: https://root.cern.ch/cling https://root.cern.ch/cling
- jarmitage 7y agoHow do these compare? I have been exploring a bit with Cling but don't know enough to evaluate the differences
- saagarjha 7y agoCling takes C++ and interprets it like a REPL would. CodeGen is a JIT compiler that takes what's essentially an IR and uses LLVM to generate assembly from it.
- chrisseaton 7y agoI think LLVM has had at least three APIs for dynamic code generation - the 'legacy' one until 3.5 (don't think it had a name?), MCJIT, and ORC. This one looks more like it's optimising the user interface, and using a kind of DSL with modern C++ features.
- eslaught 7y agoAnd in fact one of the ongoing problems with LLVM is that the interface churns so much. As a user it's a huge pain to keep up and to make sure there are no regressions. (And keep in mind this also includes performance, code size, debugging... it's not just about correctness.) I don't know if stability is a goal for this project but personally I'm hoping someone comes along and makes a stable LLVM interface (and manages to be successful with it).
- mshockwave 7y agothis topic pop up in eurollvm this year again: the LLVM C API is, and should be the only stable API. Others like C++ API or even ABI stabilities can only be considered as best-efforts.
- eslaught 7y agoCan we at least make the C API more feature complete so that it's a plausible target for more users? As far as I know it's not really a viable target for a heavy-duty user like a language compiler backend.
- hwj 7y agoI played with the Python API thinking it is feature-compatible with the C/C++ API. Unfortunately, it was not.
- stevemk14ebr 7y agoThere's similar, and smaller (no llvm) library that i like alot: https://github.com/asmjit/asmjit https://github.com/asmjit/asmjit
- m0zg 7y agoVery nice, starred. There's also xbyak, which a number of projects use: https://github.com/herumi/xbyak https://github.com/herumi/xbyak. I just wish something like this was available for ARM. There's xtaak (ARM port of xbyak), but it's woefully incomplete.
- saagarjha 7y agoThat's a very interesting DSL they've got there.
- Fronzie 7y agoAnd something which operates at a higher abstraction level: https://github.com/jmmartinez/easy-just-in-time https://github.com/jmmartinez/easy-just-in-time
- d33 7y agoDefinitely interesting. I have a couple questions: 1. Quite confused about actual use cases, could anybody come up with an example? 2. The way I see it, it's kind of a way to have run-time "macros"? 3. How much overhead does this have when shipping the code to the user? 4. Would it be difficult to implement something like this for Rust? I can see special syntax to define the functions, would it make sense to add language support for this feature?
- saagarjha 7y agoI can see this being used as an easy way to add JIT compilation to an existing interpreter.
- deleted 7y ago[deleted]
- m0zg 7y agoOne prominent use case is: you can generate linear algebra kernels that are specific to both the shape of your data and the hardware features of the machine on which the kernel is run (i.e. on a Xeon use AVX512, on desktop use AVX2, or on really old desktop use SSE). Therefore you can avoid hand-coding dozens of specializations of such kernels beforehand.
- wmobit 7y agoThis couldn't have a worse name. It's already used inside clang, and llvm. Searching "llvm CodeGen" will never find this.
- sara7262 7y agoEven you can't believe there is a hen in world's biggest animals See the video how they looks and what they do https://cutt.ly/1rOU7Q https://cutt.ly/1rOU7Q Very funny dog using toilet Try to control your laugh http://bit.ly/2LVSNSG http://bit.ly/2LVSNSG Cute dog doing exercise like humans http://bit.ly/2Jq3rz1 http://bit.ly/2Jq3rz1 Funny gorilla acting like humans see his video on link below http://bit.ly/2JmTNxr http://bit.ly/2JmTNxr Best way to get rid from dark spots on face just follow this https://zoomtips.blogspot.com/2019/05/Dark-spots.html https://zoomtips.blogspot.com/2019/05/Dark-spots.html Funny panda is playing with friends they are sho cute http://bit.ly/2JvDQF4 http://bit.ly/2JvDQF4