[llvm-mca] Fix JSON format for multiple regions
authorMarcos Horro <marcos.horro@udc.es>
Fri, 9 Jul 2021 15:58:57 +0000 (17:58 +0200)
committerMarcos Horro <marcos.horro@udc.es>
Fri, 9 Jul 2021 16:04:16 +0000 (18:04 +0200)
commitb11d31eb73a37f46a669e064b1aed77aff9f783a
tree447694f7c5f42f34e74b78101a22a513a1ae32d5
parentc282d55a38577e076b48cd7a8113e5eb0a2039cd
[llvm-mca] Fix JSON format for multiple regions

Instead of printing each region individually when using JSON format,
this patch creates a JSON object which is updated with the values of
each region, printing them at the end. New test is added for JSON output
with multiple regions.

Bug: https://bugs.llvm.org/show_bug.cgi?id=51008

Reviewed By: andreadb

Differential Revision: https://reviews.llvm.org/D105618
llvm/test/tools/llvm-mca/JSON/X86/views-multiple-region.s [new file with mode: 0644]
llvm/test/tools/llvm-mca/JSON/X86/views.s
llvm/tools/llvm-mca/PipelinePrinter.cpp
llvm/tools/llvm-mca/PipelinePrinter.h
llvm/tools/llvm-mca/Views/InstructionView.cpp
llvm/tools/llvm-mca/Views/InstructionView.h
llvm/tools/llvm-mca/llvm-mca.cpp