According to this reddit post it is possible to generate the mir representation with the nightly toolchain.
#![feature(rustc_attrs)]
#[rustc_mir(graphviz = "basic.dot")]
fn foo() {...}
However when I try it myself there is no file written by rustc.