MIR serialization format update


The MIR serialization format is a new, text-based, human readable serialization format that represents LLVM’s machine-specific IR.
I have worked on it for the last couple of months, and despite some of the limitations that it currently has, I feel that it’s ready to
be used to test some of the code generation passes in LLVM. There are several MIR tests in trunk already, e.g.: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/expand-vr64-gr64-copy.mir?revision=244982&view=co .

There are two ways you can use the MIR format:

  • You can write MIR tests and test individual code generation passes using the ‘run-pass’ option in llc.
  • You can write LLVM assembly tests and use the ‘stop-after’ option in llc. This will allow you to verify that a specific code generation pass produces the expected MIR.

The “MIR Testing Guide” section in the MIR docs (http://llvm.org/docs/MIRLangRef.html#mir-testing-guide) has more
information about how the MIR format can be used for tests. It also describes some of the current MIR limitations.

The MIR syntax is partially covered by the current docs (http://llvm.org/docs/MIRLangRef.html). Right now the syntax reference
is quite sparse, but you can expect this to change in the future. I’m also working on patches that fix some of the existing
limitations by extending the MIR format and serializing the target-specific state that is not serialized at the moment.

Feel free to email me if you have any questions about the new format!