4 ms·
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 c
by exDM69 10y ago
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.
- the_duke 10y agoYou have to be very, very careful when writing platform agnostic IR.
- exDM69 10y agoSure 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.