Turns out I can't help myself: https://github.com/yebblies/dmd/tree/microd (the makefile changes are win32 only, but aren't very compilcated)
It compiles the following into cryptic c full of mangled names just fine: __gshared int global = 3; int main() { uint x; foreach(i; 0..20) { x += i; } return 0; } Doesn't seem that hard. Dmd would need support for 8/16 bit pointers and a few other things, but I think most of the customization could be done with some well-defined macros and per-architecture header files. Some features are implemented in wrong part of the compiler, and will cause problems.