Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is there any low level language, which is actually close to modern x86_64?


Probably the closest you'll find today is LLVM IR (or maybe there's a slightly closer IR in some other compiler). In terms of languages you'd actually like to program yourself, Rust and C++ are slightly closer, but that's mostly a factor of trying to incorporate more hardware features rather than modelling hardware better.


Does anyone code directly in LLVM IR? I've had the thought of toying with it as a better portable assembly with a crazy optimizer behind it...but since the LLVM folk want it to be an implementation detail they warn against it due to how volatile it is across versions.

I'd be really interested to hear experiences of people who have done it though, even as a toy.


I've coded directly in LLVM IR a few times (mostly for testing). It's not pleasant, primarily because you have to manage the SSA construction yourself, although the CFG can also be annoying.

There is a small, very restrictive class of LLVM IR that is going to be effectively stable, and even portable. Stripping debug information goes a long way to making your IR readable by newer versions of LLVM, and staying away from C ABI compatibility (especially structs) can make your code somewhat portable.


LLVM IR isn't exactly portable, so that doesn't really work.


The bitcode variant used by Apple for their OSes tends to be more clean in that regard.


The only language close to modern x86_64 is x86_64 itself. Well, no, not really, because assembly instructions get dispatched as micro-ops…




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: