1 //===--------------------- InstructionInfoView.h ----------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// This file implements the instruction info view.
13 /// The goal fo the instruction info view is to print the latency and reciprocal
14 /// throughput information for every instruction in the input sequence.
15 /// This section also reports extra information related to the number of micro
16 /// opcodes, and opcode properties (i.e. 'MayLoad', 'MayStore', 'HasSideEffects)
26 /// [6]: HasSideEffects
28 /// [1] [2] [3] [4] [5] [6] Instructions:
29 /// 1 2 1.00 vmulps %xmm0, %xmm1, %xmm2
30 /// 1 3 1.00 vhaddps %xmm2, %xmm2, %xmm3
31 /// 1 3 1.00 vhaddps %xmm3, %xmm3, %xmm4
33 //===----------------------------------------------------------------------===//
35 #ifndef LLVM_TOOLS_LLVM_MCA_INSTRUCTIONINFOVIEW_H
36 #define LLVM_TOOLS_LLVM_MCA_INSTRUCTIONINFOVIEW_H
38 #include "Views/View.h"
39 #include "llvm/ADT/ArrayRef.h"
40 #include "llvm/MC/MCInst.h"
41 #include "llvm/MC/MCInstPrinter.h"
42 #include "llvm/MC/MCInstrInfo.h"
43 #include "llvm/MC/MCSubtargetInfo.h"
44 #include "llvm/Support/raw_ostream.h"
46 #define DEBUG_TYPE "llvm-mca"
51 /// A view that prints out generic instruction information.
52 class InstructionInfoView : public View {
53 const llvm::MCSubtargetInfo &STI;
54 const llvm::MCInstrInfo &MCII;
55 llvm::ArrayRef<llvm::MCInst> Source;
56 llvm::MCInstPrinter &MCIP;
59 InstructionInfoView(const llvm::MCSubtargetInfo &sti,
60 const llvm::MCInstrInfo &mcii,
61 llvm::ArrayRef<llvm::MCInst> S, llvm::MCInstPrinter &IP)
62 : STI(sti), MCII(mcii), Source(S), MCIP(IP) {}
64 void printView(llvm::raw_ostream &OS) const override;