plum-umd / the-838e-compiler

Compiler for CMSC 838E
2 stars 0 forks source link

IR design and new backends #20

Open dvanhorn opened 3 years ago

dvanhorn commented 3 years ago

The a86 is a nice abstraction of x86, but is still very closely tied to the details of x86. It would be nice to design a slightly higher-level of abstraction intermediate form and then design multiple back-ends, including a86. In particular, it would be great if the compiler didn't have to worry about the stack-alignment mess all the time and this could be handled later in the pipeline.

As for other backends to support: it would be great to support wasm and ARM; wasm is probably pretty easy and ARM may be more involved (and perhaps the right approach is to just target wasm and then use existing tools to target other architectures, e.g. wasmer.io.

I also think it would be fine to target something like LLVM's IR, although I would prefer to emit something that involves a little less "magic" so that future students continue to get a real sense of how everything works down to a level very close to the CPU.

This is the kind of project where an initial working version could be pretty easy to whip up but you could go down the rabbit hole arbitrarily far. This project could also support multiple different teams either competing (with different IR and back end designs) or cooperative (with a shared IR and multiple, independently designed back ends).