Hacker News new | past | comments | ask | show | jobs | submit login

This is neat, I had no idea there was an intermediate language like this which is cross platform. It would seem that I could decompile binaries using llvm tooling and then recompile for other platforms.

http://stackoverflow.com/questions/6981810/translation-of-ma...

Obviously not cross os, but might be good for bare metal stuff. I've gotten libraries in the past compiled with weird ABIs. This sounds really neat.




I'm afraid not, because the LLVM IR does not abstract for things like endianess, word size, header file contents, or many other things that are platform dependent.


LLVM IR is pretty close to portable - the issues you mention are an issue with Assembler code as well. Even the examples in the article show the same IR being compiled to different CPU architectures.

I'm not sure I'd go hand writing IR code, though. It's pretty easy to just write C code with vector extensions, etc to produce the IR I'd be after. When I do need to write assembler code these days, it's typically to get access to some privileged instructions in kernel space. Most other instructions are available in C code via __builtin_foo_bar functions.


You have to be very, very careful when writing platform agnostic IR.


Sure but you have to care about word size, endianness, etc when writing C code too.

You would not go writing entire apps with it anyway, just a few inner loops or so.

I'd still use assembly-looking C with extensions and intrinsics for that, though.




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

Search: