2014-03-14 09:58:04 +01:00
|
|
|
//===- X86AsmInstrumentation.h - Instrument X86 inline assembly *- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 18:26:38 +02:00
|
|
|
#ifndef LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMINSTRUMENTATION_H
|
|
|
|
#define LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMINSTRUMENTATION_H
|
2014-03-14 09:58:04 +01:00
|
|
|
|
|
|
|
#include "llvm/ADT/SmallVector.h"
|
|
|
|
|
2014-06-08 18:18:35 +02:00
|
|
|
#include <memory>
|
|
|
|
|
2014-03-14 09:58:04 +01:00
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class MCContext;
|
|
|
|
class MCInst;
|
2014-04-24 15:29:34 +02:00
|
|
|
class MCInstrInfo;
|
2014-03-14 09:58:04 +01:00
|
|
|
class MCParsedAsmOperand;
|
|
|
|
class MCStreamer;
|
|
|
|
class MCSubtargetInfo;
|
2014-04-23 13:16:03 +02:00
|
|
|
class MCTargetOptions;
|
2014-03-14 09:58:04 +01:00
|
|
|
|
|
|
|
class X86AsmInstrumentation;
|
|
|
|
|
2014-08-27 15:11:55 +02:00
|
|
|
X86AsmInstrumentation *
|
|
|
|
CreateX86AsmInstrumentation(const MCTargetOptions &MCOptions,
|
2015-11-14 07:35:56 +01:00
|
|
|
const MCContext &Ctx,
|
|
|
|
const MCSubtargetInfo *&STI);
|
2014-03-14 09:58:04 +01:00
|
|
|
|
|
|
|
class X86AsmInstrumentation {
|
2014-08-27 15:11:55 +02:00
|
|
|
public:
|
2014-03-14 09:58:04 +01:00
|
|
|
virtual ~X86AsmInstrumentation();
|
|
|
|
|
2014-10-07 13:03:09 +02:00
|
|
|
// Sets frame register corresponding to a current frame.
|
|
|
|
void SetInitialFrameRegister(unsigned RegNo) {
|
|
|
|
InitialFrameReg = RegNo;
|
2014-09-10 11:45:49 +02:00
|
|
|
}
|
|
|
|
|
2014-07-31 11:11:04 +02:00
|
|
|
// Tries to instrument and emit instruction.
|
|
|
|
virtual void InstrumentAndEmitInstruction(
|
2014-06-08 18:18:35 +02:00
|
|
|
const MCInst &Inst,
|
2014-09-01 14:51:00 +02:00
|
|
|
SmallVectorImpl<std::unique_ptr<MCParsedAsmOperand> > &Operands,
|
2014-06-08 18:18:35 +02:00
|
|
|
MCContext &Ctx, const MCInstrInfo &MII, MCStreamer &Out);
|
2014-03-14 09:58:04 +01:00
|
|
|
|
2014-08-27 15:11:55 +02:00
|
|
|
protected:
|
|
|
|
friend X86AsmInstrumentation *
|
|
|
|
CreateX86AsmInstrumentation(const MCTargetOptions &MCOptions,
|
2015-11-14 07:35:56 +01:00
|
|
|
const MCContext &Ctx,
|
|
|
|
const MCSubtargetInfo *&STI);
|
2014-03-14 09:58:04 +01:00
|
|
|
|
2015-11-14 07:35:56 +01:00
|
|
|
X86AsmInstrumentation(const MCSubtargetInfo *&STI);
|
2014-07-31 11:11:04 +02:00
|
|
|
|
2014-10-07 13:03:09 +02:00
|
|
|
unsigned GetFrameRegGeneric(const MCContext &Ctx, MCStreamer &Out);
|
|
|
|
|
2014-07-31 11:11:04 +02:00
|
|
|
void EmitInstruction(MCStreamer &Out, const MCInst &Inst);
|
|
|
|
|
2015-11-14 07:35:56 +01:00
|
|
|
const MCSubtargetInfo *&STI;
|
2014-09-10 11:45:49 +02:00
|
|
|
|
2014-10-07 13:03:09 +02:00
|
|
|
unsigned InitialFrameReg;
|
2014-03-14 09:58:04 +01:00
|
|
|
};
|
|
|
|
|
2015-06-23 11:49:53 +02:00
|
|
|
} // End llvm namespace
|
2014-03-14 09:58:04 +01:00
|
|
|
|
2014-08-13 18:26:38 +02:00
|
|
|
#endif
|