aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-mca/PipelinePrinter.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-mca/PipelinePrinter.h')
-rw-r--r--llvm/tools/llvm-mca/PipelinePrinter.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/llvm/tools/llvm-mca/PipelinePrinter.h b/llvm/tools/llvm-mca/PipelinePrinter.h
index ae18140d32b7..1365f75be0f5 100644
--- a/llvm/tools/llvm-mca/PipelinePrinter.h
+++ b/llvm/tools/llvm-mca/PipelinePrinter.h
@@ -18,6 +18,8 @@
#include "Views/View.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/MC/MCSubtargetInfo.h"
+#include "llvm/MCA/Context.h"
#include "llvm/MCA/Pipeline.h"
#include "llvm/Support/raw_ostream.h"
@@ -26,6 +28,8 @@
namespace llvm {
namespace mca {
+class CodeRegion;
+
/// A printer class that knows how to collects statistics on the
/// code analyzed by the llvm-mca tool.
///
@@ -35,12 +39,21 @@ namespace mca {
/// resource pressure.
class PipelinePrinter {
Pipeline &P;
+ const CodeRegion &Region;
+ unsigned RegionIdx;
+ const MCSubtargetInfo &STI;
+ const PipelineOptions &PO;
llvm::SmallVector<std::unique_ptr<View>, 8> Views;
- View::OutputKind OutputKind;
+
+ void printRegionHeader(llvm::raw_ostream &OS) const;
+ json::Object getJSONReportRegion() const;
+ json::Object getJSONTargetInfo() const;
+ json::Object getJSONSimulationParameters() const;
public:
- PipelinePrinter(Pipeline &pipeline, View::OutputKind OutputKind)
- : P(pipeline), OutputKind(OutputKind) {}
+ PipelinePrinter(Pipeline &Pipe, const CodeRegion &R, unsigned Idx,
+ const MCSubtargetInfo &STI, const PipelineOptions &PO)
+ : P(Pipe), Region(R), RegionIdx(Idx), STI(STI), PO(PO), Views() {}
void addView(std::unique_ptr<View> V) {
P.addEventListener(V.get());
@@ -48,6 +61,7 @@ public:
}
void printReport(llvm::raw_ostream &OS) const;
+ void printReport(json::Object &JO) const;
};
} // namespace mca
} // namespace llvm