Multi stage code emission using MC Layer

I’m trying to write an interprocedural code generator (in which basic blocks of a single function are not guaranteed to be contiguous) and evaluate the effect icache locality optimizations.

In order to be independent from the llvm pass infrastructure, I would like to do this in the MC Layer. So first I want to emit MC code along with basic block identifiers in the original layout, then read the MC code back in and lay the basic blocks in my interprocedural layout.

Is X86 AsmPrinter capable of emitting (and reading) MC Instructions? Has this ever been done?