4 ms·
Just so I understand, the problem is that compiling this code on a 16 bit vs 64 bit platform will produce different IR code? The IR code itself is "portable",
by greenshackle2 10y ago
Just so I understand, the problem is that compiling this code on a 16 bit vs 64 bit platform will produce different IR code?
The IR code itself is "portable", but the C to IR compiler is using target specific information?
(I've just been learning about assemblers and compilers, still trying to wrap my mind around this stuff. Would there be much educational value in writing IR code by hand?)
- pcwalton 10y ago> The IR code itself is "portable", but the C to IR compiler is using target specific information? Right. Consider how you'd compile something as simple as printf("%d", (int)sizeof(int));
- exDM69 10y agoThe point still stands, but I think sizeof(int*) or sizeof(int) is a poor example, because it could be compiled to a portable "getelementptr" LLVM instruction. However, Clang does not do this and emits a constant integer for sizeof() operations (according to my quick and dirty test).