In general a lot of the internals to compile are there, but as you observe, the auto-clustering (mark_for_compilation_pass.cc) current blacklists loops.
The auto-clustering code does not consider loops compilable for the very simple reason that the auto-clustering code depends on a cycle-detection algorithm to avoid creating deadlocks, so the easiest starting point was to simply ban loops. I think this is fixable but I don't have many cycles to put into it right now.
I think in the short term we are likely to add a more explicit "compile this part of the graph as a unit" scoping mechanism that bypasses autoclustering. One reason is performance predictability. Another reason is that if you want to compile variable reads and writes, then autoclustering changes when side-effects (such as variable reads and writes) happen. It is antisocial to change the order of effects under the user as the result of a clustering algorithm they don't know about and can't control.
I'm sure we will get back to autoclustering but it's looking slightly lower on the priority list at the moment. This is still in flux, though. Your input is welcome.
Currently the only way in the checked in tree is to use the loop translation is via the ahead-of-time compilation path, which just compiles the entire graph you give it and doesn't try to be smart about what is compiled.