1 //===- X86AsmInstrumentation.h - Instrument X86 inline assembly -*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMINSTRUMENTATION_H
10 #define LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMINSTRUMENTATION_H
12 #include "llvm/ADT/SmallVector.h"
20 class MCParsedAsmOperand
;
22 class MCSubtargetInfo
;
23 class MCTargetOptions
;
24 class X86AsmInstrumentation
;
26 X86AsmInstrumentation
*
27 CreateX86AsmInstrumentation(const MCTargetOptions
&MCOptions
,
29 const MCSubtargetInfo
*&STI
);
31 class X86AsmInstrumentation
{
33 virtual ~X86AsmInstrumentation();
35 // Sets frame register corresponding to a current frame.
36 void SetInitialFrameRegister(unsigned RegNo
) {
37 InitialFrameReg
= RegNo
;
40 // Tries to instrument and emit instruction.
41 virtual void InstrumentAndEmitInstruction(
43 SmallVectorImpl
<std::unique_ptr
<MCParsedAsmOperand
>> &Operands
,
44 MCContext
&Ctx
, const MCInstrInfo
&MII
, MCStreamer
&Out
);
47 friend X86AsmInstrumentation
*
48 CreateX86AsmInstrumentation(const MCTargetOptions
&MCOptions
,
50 const MCSubtargetInfo
*&STI
);
52 X86AsmInstrumentation(const MCSubtargetInfo
*&STI
);
54 unsigned GetFrameRegGeneric(const MCContext
&Ctx
, MCStreamer
&Out
);
56 void EmitInstruction(MCStreamer
&Out
, const MCInst
&Inst
);
58 const MCSubtargetInfo
*&STI
;
60 unsigned InitialFrameReg
= 0;
63 } // end namespace llvm
65 #endif // LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMINSTRUMENTATION_H