I don't think you need to rebuild the compiler. Here is a proposal how how this can be done using the work to compile Julia for GPU's:
https://docs.google.com/document/d/1rLpZf-HK6b9uYPDT_piUza4L...
https://docs.google.com/document/d/1rLpZf-HK6b9uYPDT_piUza4L...