LLVM 23.0.0git
llvm::instrumentor::InstrumentationLocation Struct Reference

Helper to represent an instrumentation location, which is composed of an instrumentation opportunity type and a position. More...

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

Public Types

enum  KindTy {
  MODULE_PRE , MODULE_POST , GLOBAL_PRE , GLOBAL_POST ,
  FUNCTION_PRE , FUNCTION_POST , BASIC_BLOCK_PRE , BASIC_BLOCK_POST ,
  INSTRUCTION_PRE , INSTRUCTION_POST , Last = INSTRUCTION_POST
}
 The supported location kinds, which are composed of a opportunity type and position. More...

Public Member Functions

 InstrumentationLocation (KindTy Kind)
 Construct an instrumentation location that is not instrumenting an instruction.
 InstrumentationLocation (unsigned Opcode, bool IsPRE)
 Construct an instrumentation location belonging to the instrumentation of an instruction.
KindTy getKind () const
 Return the type and position.
bool isPRE () const
 Return whether the instrumentation location is before the event occurs.
unsigned getOpcode () const
 Get the opcode of the instruction instrumentation location.

Static Public Member Functions

static StringRef getKindStr (KindTy Kind)
 Return the string representation given a location kind.
static KindTy getKindFromStr (StringRef S)
 Return the location kind described by a string.
static bool isPRE (KindTy Kind)
 Return whether a location kind is positioned before the event occurs.

Detailed Description

Helper to represent an instrumentation location, which is composed of an instrumentation opportunity type and a position.

Definition at line 149 of file Instrumentor.h.

Member Enumeration Documentation

◆ KindTy

The supported location kinds, which are composed of a opportunity type and position.

The PRE position indicates the instrumentation function call is inserted before the instrumented event occurs. The POST position indicates the instrumentation call is inserted after the event occurs. Some opportunity types may only support one position.

Enumerator
MODULE_PRE 
MODULE_POST 
GLOBAL_PRE 
GLOBAL_POST 
FUNCTION_PRE 
FUNCTION_POST 
BASIC_BLOCK_PRE 
BASIC_BLOCK_POST 
INSTRUCTION_PRE 
INSTRUCTION_POST 
Last 

Definition at line 155 of file Instrumentor.h.

Constructor & Destructor Documentation

◆ InstrumentationLocation() [1/2]

llvm::instrumentor::InstrumentationLocation::InstrumentationLocation ( KindTy Kind)
inline

Construct an instrumentation location that is not instrumenting an instruction.

Definition at line 171 of file Instrumentor.h.

References assert(), INSTRUCTION_POST, and INSTRUCTION_PRE.

◆ InstrumentationLocation() [2/2]

llvm::instrumentor::InstrumentationLocation::InstrumentationLocation ( unsigned Opcode,
bool IsPRE )
inline

Construct an instrumentation location belonging to the instrumentation of an instruction.

Definition at line 178 of file Instrumentor.h.

References INSTRUCTION_POST, and INSTRUCTION_PRE.

Member Function Documentation

◆ getKind()

KindTy llvm::instrumentor::InstrumentationLocation::getKind ( ) const
inline

Return the type and position.

Definition at line 182 of file Instrumentor.h.

◆ getKindFromStr()

KindTy llvm::instrumentor::InstrumentationLocation::getKindFromStr ( StringRef S)
inlinestatic

◆ getKindStr()

StringRef llvm::instrumentor::InstrumentationLocation::getKindStr ( KindTy Kind)
inlinestatic

Return the string representation given a location kind.

This is the string used in the configuration file.

Definition at line 186 of file Instrumentor.h.

References BASIC_BLOCK_POST, BASIC_BLOCK_PRE, FUNCTION_POST, FUNCTION_PRE, GLOBAL_POST, GLOBAL_PRE, INSTRUCTION_POST, INSTRUCTION_PRE, llvm_unreachable, MODULE_POST, and MODULE_PRE.

Referenced by llvm::instrumentor::writeConfigToJSON().

◆ getOpcode()

unsigned llvm::instrumentor::InstrumentationLocation::getOpcode ( ) const
inline

Get the opcode of the instruction instrumentation location.

This function may not be called by a non-instruction instrumentation location.

Definition at line 252 of file Instrumentor.h.

References assert(), INSTRUCTION_POST, and INSTRUCTION_PRE.

◆ isPRE() [1/2]

bool llvm::instrumentor::InstrumentationLocation::isPRE ( ) const
inline

Return whether the instrumentation location is before the event occurs.

Definition at line 248 of file Instrumentor.h.

References isPRE().

Referenced by isPRE().

◆ isPRE() [2/2]

bool llvm::instrumentor::InstrumentationLocation::isPRE ( KindTy Kind)
inlinestatic

Return whether a location kind is positioned before the event occurs.

Definition at line 229 of file Instrumentor.h.

References BASIC_BLOCK_POST, BASIC_BLOCK_PRE, FUNCTION_POST, FUNCTION_PRE, GLOBAL_POST, GLOBAL_PRE, INSTRUCTION_POST, INSTRUCTION_PRE, llvm_unreachable, MODULE_POST, and MODULE_PRE.


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