This is a first cut at creating JSON output for MCA views.
Generate JSON by using --json on the command line. llvm-mca generates either its readable output as before or JSON. At the moment they cannot be both generated with just one run.
4 views are implemented:
There is a major and minor version included as key/value pairs in the output. The views appear in alphabetical order.
The test case is rather rigid. It checks for every single line emitted. It can possibly be shortened, but I don't know what a compromise would be. There is also a need to check that regular output and JSON output match from a data point of view. This would involve creating a tool that would check the 2 different outputs for deviations.
Let me know what you think.