X86AsmInstrumentation.h revision cd81d94322a39503e4a3e87b6ee03d4fcb3465fb
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 X86_ASM_INSTRUMENTATION_H
11#define X86_ASM_INSTRUMENTATION_H
12
13#include "llvm/ADT/SmallVector.h"
14
15#include <memory>
16
17namespace llvm {
18
19class MCContext;
20class MCInst;
21class MCInstrInfo;
22class MCParsedAsmOperand;
23class MCStreamer;
24class MCSubtargetInfo;
25class MCTargetOptions;
26
27class X86AsmInstrumentation;
28
29X86AsmInstrumentation *
30CreateX86AsmInstrumentation(const MCTargetOptions &MCOptions,
31                            const MCContext &Ctx, const MCSubtargetInfo &STI);
32
33class X86AsmInstrumentation {
34public:
35  virtual ~X86AsmInstrumentation();
36
37  // Instruments Inst. Should be called just before the original
38  // instruction is sent to Out.
39  virtual void InstrumentInstruction(
40      const MCInst &Inst,
41      SmallVectorImpl<std::unique_ptr<MCParsedAsmOperand>> &Operands,
42      MCContext &Ctx, const MCInstrInfo &MII, MCStreamer &Out);
43
44protected:
45  friend X86AsmInstrumentation *
46  CreateX86AsmInstrumentation(const MCTargetOptions &MCOptions,
47                              const MCContext &Ctx, const MCSubtargetInfo &STI);
48
49  X86AsmInstrumentation();
50};
51
52} // End llvm namespace
53
54#endif // X86_ASM_INSTRUMENTATION_H
55