Revert r354244 "[DAGCombiner] Eliminate dead stores to stack."
[llvm-complete.git] / lib / Target / X86 / AsmParser / X86AsmInstrumentation.h
blob58ecd7d967569386eaef314475bd057299487d0b
1 //===- X86AsmInstrumentation.h - Instrument X86 inline assembly -*- C++ -*-===//
2 //
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
6 //
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"
13 #include <memory>
15 namespace llvm {
17 class MCContext;
18 class MCInst;
19 class MCInstrInfo;
20 class MCParsedAsmOperand;
21 class MCStreamer;
22 class MCSubtargetInfo;
23 class MCTargetOptions;
24 class X86AsmInstrumentation;
26 X86AsmInstrumentation *
27 CreateX86AsmInstrumentation(const MCTargetOptions &MCOptions,
28 const MCContext &Ctx,
29 const MCSubtargetInfo *&STI);
31 class X86AsmInstrumentation {
32 public:
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(
42 const MCInst &Inst,
43 SmallVectorImpl<std::unique_ptr<MCParsedAsmOperand>> &Operands,
44 MCContext &Ctx, const MCInstrInfo &MII, MCStreamer &Out);
46 protected:
47 friend X86AsmInstrumentation *
48 CreateX86AsmInstrumentation(const MCTargetOptions &MCOptions,
49 const MCContext &Ctx,
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