• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===--------------------- InstructionInfoView.h ----------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 /// \file
10 ///
11 /// This file implements the instruction info view.
12 ///
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)
17 ///
18 /// Example:
19 ///
20 /// Instruction Info:
21 /// [1]: #uOps
22 /// [2]: Latency
23 /// [3]: RThroughput
24 /// [4]: MayLoad
25 /// [5]: MayStore
26 /// [6]: HasSideEffects
27 ///
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
32 //
33 //===----------------------------------------------------------------------===//
34 
35 #ifndef LLVM_TOOLS_LLVM_MCA_INSTRUCTIONINFOVIEW_H
36 #define LLVM_TOOLS_LLVM_MCA_INSTRUCTIONINFOVIEW_H
37 
38 #include "SourceMgr.h"
39 #include "View.h"
40 #include "llvm/MC/MCInstPrinter.h"
41 #include "llvm/MC/MCInstrInfo.h"
42 #include "llvm/MC/MCSubtargetInfo.h"
43 #include "llvm/Support/raw_ostream.h"
44 
45 #define DEBUG_TYPE "llvm-mca"
46 
47 namespace mca {
48 
49 /// A view that prints out generic instruction information.
50 class InstructionInfoView : public View {
51   const llvm::MCSubtargetInfo &STI;
52   const llvm::MCInstrInfo &MCII;
53   const SourceMgr &Source;
54   llvm::MCInstPrinter &MCIP;
55 
56 public:
InstructionInfoView(const llvm::MCSubtargetInfo & sti,const llvm::MCInstrInfo & mcii,const SourceMgr & S,llvm::MCInstPrinter & IP)57   InstructionInfoView(const llvm::MCSubtargetInfo &sti,
58                       const llvm::MCInstrInfo &mcii, const SourceMgr &S,
59                       llvm::MCInstPrinter &IP)
60       : STI(sti), MCII(mcii), Source(S), MCIP(IP) {}
61 
62   void printView(llvm::raw_ostream &OS) const override;
63 };
64 } // namespace mca
65 
66 #endif
67