2c3d05d1d41e27d9c6c3a1a8278fa2986e217658
[oota-llvm.git] / lib / Target / X86 / AsmParser / X86AsmInstrumentation.h
1 //===- X86AsmInstrumentation.h - Instrument X86 inline assembly *- 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
10 #ifndef LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMINSTRUMENTATION_H
11 #define LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMINSTRUMENTATION_H
12
13 #include "llvm/ADT/SmallVector.h"
14
15 #include <memory>
16
17 namespace llvm {
18
19 class MCContext;
20 class MCInst;
21 class MCInstrInfo;
22 class MCParsedAsmOperand;
23 class MCStreamer;
24 class MCSubtargetInfo;
25 class MCTargetOptions;
26
27 class X86AsmInstrumentation;
28
29 X86AsmInstrumentation *CreateX86AsmInstrumentation(
30     const MCTargetOptions &MCOptions, const MCContext &Ctx,
31     const MCSubtargetInfo &STI);
32
33 class X86AsmInstrumentation {
34  public:
35   virtual ~X86AsmInstrumentation();
36
37   // Tries to instrument and emit instruction.
38   virtual void InstrumentAndEmitInstruction(
39       const MCInst &Inst,
40       SmallVectorImpl<std::unique_ptr<MCParsedAsmOperand>> &Operands,
41       MCContext &Ctx, const MCInstrInfo &MII, MCStreamer &Out);
42
43  protected:
44   friend X86AsmInstrumentation *CreateX86AsmInstrumentation(
45       const MCTargetOptions &MCOptions, const MCContext &Ctx,
46       const MCSubtargetInfo &STI);
47
48   X86AsmInstrumentation(const MCSubtargetInfo &STI);
49
50   void EmitInstruction(MCStreamer &Out, const MCInst &Inst);
51
52   const MCSubtargetInfo &STI;
53 };
54
55 }  // End llvm namespace
56
57 #endif