LLVM  5.0.0
X86AsmInstrumentation.h
Go to the documentation of this file.
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 #include <memory>
15 
16 namespace llvm {
17 
18 class MCContext;
19 class MCInst;
20 class MCInstrInfo;
21 class MCParsedAsmOperand;
22 class MCStreamer;
23 class MCSubtargetInfo;
24 class MCTargetOptions;
25 class X86AsmInstrumentation;
26 
27 X86AsmInstrumentation *
28 CreateX86AsmInstrumentation(const MCTargetOptions &MCOptions,
29  const MCContext &Ctx,
30  const MCSubtargetInfo *&STI);
31 
33 public:
34  virtual ~X86AsmInstrumentation();
35 
36  // Sets frame register corresponding to a current frame.
37  void SetInitialFrameRegister(unsigned RegNo) {
38  InitialFrameReg = RegNo;
39  }
40 
41  // Tries to instrument and emit instruction.
42  virtual void InstrumentAndEmitInstruction(
43  const MCInst &Inst,
44  SmallVectorImpl<std::unique_ptr<MCParsedAsmOperand>> &Operands,
45  MCContext &Ctx, const MCInstrInfo &MII, MCStreamer &Out);
46 
47 protected:
48  friend X86AsmInstrumentation *
50  const MCContext &Ctx,
51  const MCSubtargetInfo *&STI);
52 
54 
55  unsigned GetFrameRegGeneric(const MCContext &Ctx, MCStreamer &Out);
56 
57  void EmitInstruction(MCStreamer &Out, const MCInst &Inst);
58 
60 
61  unsigned InitialFrameReg = 0;
62 };
63 
64 } // end namespace llvm
65 
66 #endif // LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMINSTRUMENTATION_H
virtual void InstrumentAndEmitInstruction(const MCInst &Inst, SmallVectorImpl< std::unique_ptr< MCParsedAsmOperand >> &Operands, MCContext &Ctx, const MCInstrInfo &MII, MCStreamer &Out)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
Context object for machine code objects.
Definition: MCContext.h:59
X86AsmInstrumentation(const MCSubtargetInfo *&STI)
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:159
Streaming machine code generation interface.
Definition: MCStreamer.h:167
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:24
unsigned GetFrameRegGeneric(const MCContext &Ctx, MCStreamer &Out)
X86AsmInstrumentation * CreateX86AsmInstrumentation(const MCTargetOptions &MCOptions, const MCContext &Ctx, const MCSubtargetInfo *&STI)
friend X86AsmInstrumentation * CreateX86AsmInstrumentation(const MCTargetOptions &MCOptions, const MCContext &Ctx, const MCSubtargetInfo *&STI)
MCSubtargetInfo - Generic base class for all target subtargets.
const MCSubtargetInfo *& STI
void EmitInstruction(MCStreamer &Out, const MCInst &Inst)
void SetInitialFrameRegister(unsigned RegNo)