News for hackers. Stuff that matters.
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by wmobit on Sunday May 19, 2019 @07:28PM (#19956254)
This couldn't have a worse name. It's already used inside clang, and llvm. Searching "llvm CodeGen" will never find this.
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by chrisseaton on Sunday May 19, 2019 @03:38PM (#19955036)
I 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.
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by eslaught on Sunday May 19, 2019 @05:20PM (#19955578)
And 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).

Re:CodeGen: LLVM wrapper for just-in-time code generation an... by mshockwave on Sunday May 19, 2019 @06:09PM (#19955839)
this 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.
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by eslaught on Sunday May 19, 2019 @06:39PM (#19956006)
Can 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.
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by hwj on Monday May 20, 2019 @08:37AM (#19959737)
I played with the Python API thinking it is feature-compatible with the C/C++ API. Unfortunately, it was not.
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by stevemk14ebr on Sunday May 19, 2019 @04:51PM (#19955449)
There's similar, and smaller (no llvm) library that i like alot: https://github.com/asmjit/asmjit
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by m0zg on Sunday May 19, 2019 @04:56PM (#19955473)
Very nice, starred. There's also xbyak, which a number of projects use: 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.

Re:CodeGen: LLVM wrapper for just-in-time code generation an... by saagarjha on Sunday May 19, 2019 @05:07PM (#19955520)
That's a very interesting DSL they've got there.
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by Fronzie on Monday May 20, 2019 @02:20AM (#19957931)
And something which operates at a higher abstraction level: https://github.com/jmmartinez/easy-just-in-time
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by saagarjha on Sunday May 19, 2019 @03:29PM (#19954973)
Related is cling, the C++ “interpreter”: https://root.cern.ch/cling
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by jarmitage on Sunday May 19, 2019 @07:23PM (#19956227)
How do these compare? I have been exploring a bit with Cling but don't know enough to evaluate the differences
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by saagarjha on Sunday May 19, 2019 @07:27PM (#19956250)
Cling 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.
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by rurban on Monday May 20, 2019 @01:54AM (#19957851)
cling got a C++ jit via LLVM lately. When you add or change a function, it's jitted.
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by saagarjha on Monday May 20, 2019 @02:01AM (#19957867)
I think it always had a JIT?
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by d33 on Sunday May 19, 2019 @05:38PM (#19955676)
Definitely 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?

Re:CodeGen: LLVM wrapper for just-in-time code generation an... by m0zg on Monday May 20, 2019 @01:10AM (#19957695)
One 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.
Re:CodeGen: LLVM wrapper for just-in-time code generation an... by saagarjha on Sunday May 19, 2019 @05:54PM (#19955763)
I can see this being used as an easy way to add JIT compilation to an existing interpreter.