Supporting external MCContext in MMI

Hi we have something like an external driver that likes to own MCInst data externally, i.e. outside from LLVM. By default, the MachineModuleInfo/WrapperPass creates its own context in the constructor of MachineModuleInfo. MMI’s context is used throughout codegen. When using a MCStreamer with an external context one can achieve almost what we want, because the streamer’s context is used to create MCInst, but not all data will be owned by the streamer’s context. For example symbols are still owned by MMI’s context.

I’m suggesting to do something like providing the ability to make MMI use an external context. Would this be something that somebody would review and ok?

Thanks in advance, Hendrik.