Serializing/Deserializing MIR Pass Body

Is it possible to serialize/deserialize the Body of MIR pass? or am I reinventing the wheel

I'm planning to do the following:

  • For the same original Rust code (= same TyCtxt)
    • A. Serialize the Body right after passing through the MIR pass and save it to a file.
    • B. Before passing through the MIR pass, deserialize the file saved in A and replace the Body received as an argument in run_pass().

I'm working on mutation testing using MIR pass to find rustc bugs, and for corpus handling, I came up with the above method.