3 ms·
> Actually compiling this turned out to be an amusing excercise, because MIPS cores without hardware multiply or divide support aren't officially a thing anymor
by saagarjha 8y ago
> Actually compiling this turned out to be an amusing excercise, because MIPS cores without hardware multiply or divide support aren't officially a thing anymore, which means that neither clang or GCC support targeting such devices.
I'm curious what the demand is for a simple, non-optimizing C compiler that translates code into the most straightforward assembly possible (i.e. a true "portable assembler").
- voltagex_ 8y agoDefine simple - what do you leave out? From the article, not having divide or multiply is an anomaly.
- saagarjha 8y agoI'm saying something like a very simple mapping between operations and their assembly, which means it's easy to say rip out the multiplication and division and replace it with an alternate implementation in the code generator.
- stevekemp 8y agoAll you need is `mov`: https://github.com/xoreaxeaxeax/movfuscator/ https://github.com/xoreaxeaxeax/movfuscator/ Including the obligatory port of doom: https://github.com/xoreaxeaxeax/movfuscator/tree/master/validation/doom https://github.com/xoreaxeaxeax/movfuscator/tree/master/vali... Note: The mov-only DOOM renders approximately one frame every 7 hours, so playing this version requires somewhat increased patience.
- pjc50 8y agoSeveral of those are available already. https://bellard.org/tcc/ https://bellard.org/tcc/ is one example, although not "portable" in the sense that it only has an x86 backend.
- saagarjha 8y ago> not "portable" in the sense that it only has an x86 backend Yeah, that's kind of a dealbreaker.
- pjc50 8y agoOn the other hand, once you have a portable intermediate representation, and code for various backends, it's hard to imagine anything smaller than LLVM? Assembly itself is highly non-portable.