LLVM  8.0.1
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  bool PrintSchedInfoEnabled);
47 
48 protected:
49  friend X86AsmInstrumentation *
51  const MCContext &Ctx,
52  const MCSubtargetInfo *&STI);
53 
55 
56  unsigned GetFrameRegGeneric(const MCContext &Ctx, MCStreamer &Out);
57 
58  void EmitInstruction(MCStreamer &Out, const MCInst &Inst,
59  bool PrintSchedInfoEnabled = false);
60 
62 
63  unsigned InitialFrameReg = 0;
64 };
65 
66 } // end namespace llvm
67 
68 #endif // LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMINSTRUMENTATION_H
This class represents lattice values for constants.
Definition: AllocatorList.h:24
virtual void InstrumentAndEmitInstruction(const MCInst &Inst, SmallVectorImpl< std::unique_ptr< MCParsedAsmOperand >> &Operands, MCContext &Ctx, const MCInstrInfo &MII, MCStreamer &Out, bool PrintSchedInfoEnabled)
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:63
X86AsmInstrumentation(const MCSubtargetInfo *&STI)
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:161
Streaming machine code generation interface.
Definition: MCStreamer.h:189
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)
void EmitInstruction(MCStreamer &Out, const MCInst &Inst, bool PrintSchedInfoEnabled=false)
Generic base class for all target subtargets.
const MCSubtargetInfo *& STI
void SetInitialFrameRegister(unsigned RegNo)