LLVM 23.0.0git
llvm::instrumentor::InstructionIO< Opcodes > Struct Template Reference

The common instrumentation opportunity class for instruction opportunities. More...

#include "llvm/Transforms/IPO/Instrumentor.h"

Inheritance diagram for llvm::instrumentor::InstructionIO< Opcodes >:
[legend]

Public Member Functions

virtual ~InstructionIO ()
 InstructionIO (InstrumentationLocation::KindTy Kind)
 Construct an instruction opportunity.
ArrayRef< unsignedgetAllOpcodes () const override
 Get all opcodes for this instrumentation opportunity (override).
virtual StringRef getName () const override
 Get the name of the instruction.
Public Member Functions inherited from llvm::instrumentor::BaseInstructionIO
virtual ~BaseInstructionIO ()
 BaseInstructionIO (InstrumentationLocation::KindTy Kind)
Public Member Functions inherited from llvm::instrumentor::InstrumentationOpportunity
virtual ~InstrumentationOpportunity ()
 InstrumentationOpportunity (const InstrumentationLocation IP)
 Construct an opportunity with location IP.
virtual Valueinstrument (Value *&V, bool &Changed, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB, InstrumentationCaches &ICaches)
 }
virtual TypegetRetTy (LLVMContext &Ctx) const
 Get the return type for the instrumentation runtime function.
InstrumentationLocation::KindTy getLocationKind () const
 Get the location kind of the instrumentation opportunity.
void addCommonArgs (InstrumentationConfig &IConf, LLVMContext &Ctx, bool PassId)
 }

Static Public Member Functions

static constexpr size_t getNumOpcodes ()
 Get the number of opcodes.
Static Public Member Functions inherited from llvm::instrumentor::BaseInstructionIO
static LLVM_ABI ValuegetOpcode (Value &V, Type &Ty, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB)
static LLVM_ABI ValuegetTypeSize (Value &V, Type &Ty, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB)
static LLVM_ABI ValuegetLeftOperand (Value &V, Type &Ty, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB)
static LLVM_ABI ValuegetRightOperand (Value &V, Type &Ty, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB)
static LLVM_ABI ValuegetTypeId (Value &V, Type &Ty, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB)
static LLVM_ABI ValuegetSubTypeId (Value &V, Type &Ty, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB)
Static Public Member Functions inherited from llvm::instrumentor::InstrumentationOpportunity
static LLVM_ABI ValueforceCast (Value &V, Type &Ty, InstrumentorIRBuilderTy &IIRB)
 Helpers to cast values, pass them to the runtime, and replace them.
static ValuegetValue (Value &V, Type &Ty, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB)
static LLVM_ABI ValuereplaceValue (Value &V, Value &NewV, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB)
static LLVM_ABI ValuegetIdPre (Value &V, Type &Ty, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB)
 Get the opportunity identifier for the pre and post positions.
static LLVM_ABI ValuegetIdPost (Value &V, Type &Ty, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB)
static int32_t getIdFromEpoch (uint32_t CurrentEpoch)
 }

Static Public Attributes

static constexpr std::array< unsigned, sizeof...(Opcodes)> OpcodesArray

Additional Inherited Members

Public Types inherited from llvm::instrumentor::InstrumentationOpportunity
using CallbackTy = std::function<bool(Value &)>
 An optional callback that takes the value that is about to be instrumented and can return false if it should be skipped.
Public Attributes inherited from llvm::instrumentor::InstrumentationOpportunity
InstrumentationLocation IP
 The instrumentation location of the opportunity.
SmallVector< IRTArgIRTArgs
 The list of possible arguments for the instrumentation runtime function.
bool Enabled = true
 Whether the opportunity is enabled.
StringRef Filter
 A filter expression to be matched against runtime property values.
CallbackTy CB = nullptr

Detailed Description

template<unsigned... Opcodes>
struct llvm::instrumentor::InstructionIO< Opcodes >

The common instrumentation opportunity class for instruction opportunities.

Each instruction opportunity should inherit from this class and implement the virtual class members. If multiple opcodes are provided, all of them are instrumented using the same logic, and a name must be explicitly provided by overriding getName().

Definition at line 620 of file Instrumentor.h.

Constructor & Destructor Documentation

◆ ~InstructionIO()

template<unsigned... Opcodes>
virtual llvm::instrumentor::InstructionIO< Opcodes >::~InstructionIO ( )
inlinevirtual

Definition at line 621 of file Instrumentor.h.

◆ InstructionIO()

template<unsigned... Opcodes>
llvm::instrumentor::InstructionIO< Opcodes >::InstructionIO ( InstrumentationLocation::KindTy Kind)
inline

Construct an instruction opportunity.

Definition at line 624 of file Instrumentor.h.

References llvm::instrumentor::BaseInstructionIO::BaseInstructionIO().

Member Function Documentation

◆ getAllOpcodes()

template<unsigned... Opcodes>
ArrayRef< unsigned > llvm::instrumentor::InstructionIO< Opcodes >::getAllOpcodes ( ) const
inlineoverridevirtual

Get all opcodes for this instrumentation opportunity (override).

Reimplemented from llvm::instrumentor::InstrumentationOpportunity.

Definition at line 634 of file Instrumentor.h.

References OpcodesArray.

◆ getName()

template<unsigned... Opcodes>
virtual StringRef llvm::instrumentor::InstructionIO< Opcodes >::getName ( ) const
inlineoverridevirtual

Get the name of the instruction.

For single-opcode IOs, this defaults to the opcode name. For multi-opcode IOs, getName() MUST be overridden to provide an explicit name identifying the whole group of opcodes.

Implements llvm::instrumentor::InstrumentationOpportunity.

Reimplemented in llvm::instrumentor::CastIO, llvm::instrumentor::CompareIO, and llvm::instrumentor::NumericIO.

Definition at line 642 of file Instrumentor.h.

References assert(), llvm::Instruction::getOpcodeName(), and OpcodesArray.

◆ getNumOpcodes()

template<unsigned... Opcodes>
constexpr size_t llvm::instrumentor::InstructionIO< Opcodes >::getNumOpcodes ( )
inlinestaticconstexpr

Get the number of opcodes.

Definition at line 637 of file Instrumentor.h.

References OpcodesArray.

Member Data Documentation

◆ OpcodesArray

template<unsigned... Opcodes>
std::array<unsigned, sizeof...(Opcodes)> llvm::instrumentor::InstructionIO< Opcodes >::OpcodesArray
staticconstexpr
Initial value:
= {
Opcodes...}

Definition at line 630 of file Instrumentor.h.

Referenced by getAllOpcodes(), getName(), and getNumOpcodes().


The documentation for this struct was generated from the following file: