|
LLVM 23.0.0git
|
Base class for instrumentation opportunities. More...
#include "llvm/Transforms/IPO/Instrumentor.h"
Public Types | |
| 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 Member Functions | |
| virtual | ~InstrumentationOpportunity () |
| InstrumentationOpportunity (const InstrumentationLocation IP) | |
Construct an opportunity with location IP. | |
| virtual Value * | instrument (Value *&V, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB, InstrumentationCaches &ICaches) |
| } | |
| virtual Type * | getRetTy (LLVMContext &Ctx) const |
| Get the return type for the instrumentation runtime function. | |
| virtual StringRef | getName () const =0 |
| Get the name of the instrumentation opportunity. | |
| unsigned | getOpcode () const |
| Get the opcode of the instruction instrumentation opportunity. | |
| 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 Value * | forceCast (Value &V, Type &Ty, InstrumentorIRBuilderTy &IIRB) |
| Helpers to cast values, pass them to the runtime, and replace them. | |
| static Value * | getValue (Value &V, Type &Ty, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB) |
| static Value * | replaceValue (Value &V, Value &NewV, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB) |
| static Value * | getIdPre (Value &V, Type &Ty, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB) |
| Get the opportunity identifier for the pre and post positions. | |
| static Value * | getIdPost (Value &V, Type &Ty, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB) |
| static int32_t | getIdFromEpoch (uint32_t CurrentEpoch) |
| } | |
Public Attributes | |
| InstrumentationLocation | IP |
| The instrumentation location of the opportunity. | |
| SmallVector< IRTArg > | IRTArgs |
| 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 |
Base class for instrumentation opportunities.
All opportunities should inherit from this class and implement the virtual class members.
Definition at line 463 of file Instrumentor.h.
| using llvm::instrumentor::InstrumentationOpportunity::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.
{
Definition at line 543 of file Instrumentor.h.
|
inlinevirtual |
Definition at line 464 of file Instrumentor.h.
|
inline |
Construct an opportunity with location IP.
Definition at line 467 of file Instrumentor.h.
References IP.
Referenced by llvm::instrumentor::FunctionIO::FunctionIO(), llvm::instrumentor::GlobalVarIO::GlobalVarIO(), llvm::instrumentor::InstructionIO< Opcode >::InstructionIO(), and llvm::instrumentor::ModuleIO::ModuleIO().
|
inline |
}
Add arguments available in all instrumentation opportunities.
Definition at line 548 of file Instrumentor.h.
References CB, getIdPost(), getIdPre(), llvm::Type::getInt32Ty(), IP, IRTArgs, and llvm::instrumentor::IRTArg::NONE.
Referenced by llvm::instrumentor::AllocaIO::init(), llvm::instrumentor::FunctionIO::init(), llvm::instrumentor::GlobalVarIO::init(), llvm::instrumentor::LoadIO::init(), llvm::instrumentor::ModuleIO::init(), llvm::instrumentor::StoreIO::init(), and llvm::instrumentor::UnreachableIO::init().
|
static |
Helpers to cast values, pass them to the runtime, and replace them.
To be used as part of the getter/setter of a InstrumentationOpportunity. {
Definition at line 550 of file Instrumentor.cpp.
References llvm::Constant::getNullValue(), and llvm::instrumentor::InstrumentorIRBuilderTy::IRB.
Referenced by getValue().
|
inlinestatic |
}
Compute the opportunity identifier for the current instrumentation epoch CurrentEpoch. The identifiers are assigned consecutively as the epoch advances. Epochs may have no identifier assigned (e.g., because no id was requested). This function always returns the same identifier when called multiple times with the same epoch.
Definition at line 572 of file Instrumentor.h.
Referenced by getIdPost(), and getIdPre().
|
static |
Definition at line 544 of file Instrumentor.cpp.
References llvm::instrumentor::InstrumentorIRBuilderTy::Epoch, and getIdFromEpoch().
Referenced by addCommonArgs().
|
static |
Get the opportunity identifier for the pre and post positions.
{
Definition at line 538 of file Instrumentor.cpp.
References llvm::instrumentor::InstrumentorIRBuilderTy::Epoch, and getIdFromEpoch().
Referenced by addCommonArgs().
|
inline |
Get the location kind of the instrumentation opportunity.
Definition at line 536 of file Instrumentor.h.
References IP.
Referenced by llvm::instrumentor::InstrumentationConfig::addChoice(), llvm::instrumentor::AllocaIO::init(), llvm::instrumentor::FunctionIO::init(), llvm::instrumentor::GlobalVarIO::init(), llvm::instrumentor::LoadIO::init(), and llvm::instrumentor::StoreIO::init().
|
pure virtual |
Get the name of the instrumentation opportunity.
Implemented in llvm::instrumentor::FunctionIO, llvm::instrumentor::GlobalVarIO, llvm::instrumentor::InstructionIO< Opcode >, llvm::instrumentor::InstructionIO< Instruction::Alloca >, llvm::instrumentor::InstructionIO< Instruction::Load >, llvm::instrumentor::InstructionIO< Instruction::Store >, llvm::instrumentor::InstructionIO< Instruction::Unreachable >, and llvm::instrumentor::ModuleIO.
Referenced by llvm::instrumentor::InstrumentationConfig::addChoice(), and llvm::instrumentor::evaluateFilter().
|
inline |
Get the opcode of the instruction instrumentation opportunity.
Only valid if it is instruction instrumentation.
Definition at line 533 of file Instrumentor.h.
References IP.
|
inlinevirtual |
Get the return type for the instrumentation runtime function.
Definition at line 526 of file Instrumentor.h.
Referenced by instrument().
|
inlinestatic |
Definition at line 498 of file Instrumentor.h.
References forceCast().
Referenced by llvm::instrumentor::AllocaIO::init().
|
inlinevirtual |
}
Instrument the value V using the configuration IConf, and potentially, the caches ICaches.
Definition at line 509 of file Instrumentor.h.
References CB, llvm::instrumentor::IRTCallDescription::createLLVMCall(), DL, llvm::instrumentor::evaluateFilter(), getRetTy(), and llvm::instrumentor::InstrumentorIRBuilderTy::IRB.
|
static |
Definition at line 558 of file Instrumentor.cpp.
References llvm::cast(), llvm::instrumentor::InstrumentorIRBuilderTy::DL, llvm::dyn_cast(), llvm::instrumentor::InstrumentorIRBuilderTy::Epoch, llvm::Value::getType(), I, llvm::instrumentor::InstrumentorIRBuilderTy::IRB, llvm::isa(), llvm::instrumentor::InstrumentorIRBuilderTy::NewInsts, and llvm::Value::replaceUsesWithIf().
Referenced by llvm::instrumentor::AllocaIO::init(), and llvm::instrumentor::LoadIO::init().
| CallbackTy llvm::instrumentor::InstrumentationOpportunity::CB = nullptr |
Definition at line 544 of file Instrumentor.h.
Referenced by addCommonArgs(), instrument(), and llvm::instrumentor::FunctionIO::setArguments().
| bool llvm::instrumentor::InstrumentationOpportunity::Enabled = true |
Whether the opportunity is enabled.
Definition at line 478 of file Instrumentor.h.
| StringRef llvm::instrumentor::InstrumentationOpportunity::Filter |
A filter expression to be matched against runtime property values.
If the filter is non-empty, only instrumentations matching the filter will be executed. The filter syntax supports:
Definition at line 492 of file Instrumentor.h.
Referenced by llvm::instrumentor::evaluateFilter().
| InstrumentationLocation llvm::instrumentor::InstrumentationOpportunity::IP |
The instrumentation location of the opportunity.
Definition at line 470 of file Instrumentor.h.
Referenced by addCommonArgs(), getLocationKind(), getOpcode(), and InstrumentationOpportunity().
| SmallVector<IRTArg> llvm::instrumentor::InstrumentationOpportunity::IRTArgs |
The list of possible arguments for the instrumentation runtime function.
The order within the array determines the order of arguments. Arguments may be disabled and will not be passed to the function call.
Definition at line 475 of file Instrumentor.h.
Referenced by addCommonArgs(), llvm::instrumentor::evaluateFilter(), llvm::instrumentor::AllocaIO::init(), llvm::instrumentor::FunctionIO::init(), llvm::instrumentor::GlobalVarIO::init(), llvm::instrumentor::LoadIO::init(), llvm::instrumentor::ModuleIO::init(), and llvm::instrumentor::StoreIO::init().