|
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. | |
| CallbackTy | CB = nullptr |
Base class for instrumentation opportunities.
All opportunities should inherit from this class and implement the virtual class members.
Definition at line 409 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 471 of file Instrumentor.h.
|
inlinevirtual |
Definition at line 410 of file Instrumentor.h.
|
inline |
Construct an opportunity with location IP.
Definition at line 413 of file Instrumentor.h.
References IP.
Referenced by llvm::instrumentor::InstructionIO< Opcode >::InstructionIO().
|
inline |
}
Add arguments available in all instrumentation opportunities.
Definition at line 476 of file Instrumentor.h.
References CB, getIdPost(), getIdPre(), llvm::Type::getInt32Ty(), IP, IRTArgs, and llvm::instrumentor::IRTArg::NONE.
Referenced by llvm::instrumentor::LoadIO::init(), and llvm::instrumentor::StoreIO::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 340 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 500 of file Instrumentor.h.
Referenced by getIdPost(), and getIdPre().
|
static |
Definition at line 334 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 328 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 464 of file Instrumentor.h.
References IP.
Referenced by llvm::instrumentor::InstrumentationConfig::addChoice(), llvm::instrumentor::LoadIO::init(), and llvm::instrumentor::StoreIO::init().
|
pure virtual |
Get the name of the instrumentation opportunity.
Implemented in llvm::instrumentor::InstructionIO< Opcode >, llvm::instrumentor::InstructionIO< Instruction::Load >, and llvm::instrumentor::InstructionIO< Instruction::Store >.
Referenced by llvm::instrumentor::InstrumentationConfig::addChoice().
|
inline |
Get the opcode of the instruction instrumentation opportunity.
Only valid if it is instruction instrumentation.
Definition at line 461 of file Instrumentor.h.
References IP.
|
inlinevirtual |
Get the return type for the instrumentation runtime function.
Definition at line 454 of file Instrumentor.h.
Referenced by instrument().
|
inlinestatic |
Definition at line 430 of file Instrumentor.h.
References forceCast().
|
inlinevirtual |
}
Instrument the value V using the configuration IConf, and potentially, the caches ICaches.
Definition at line 441 of file Instrumentor.h.
References CB, llvm::instrumentor::IRTCallDescription::createLLVMCall(), DL, getRetTy(), and llvm::instrumentor::InstrumentorIRBuilderTy::IRB.
|
static |
Definition at line 348 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::LoadIO::init().
| CallbackTy llvm::instrumentor::InstrumentationOpportunity::CB = nullptr |
Definition at line 472 of file Instrumentor.h.
Referenced by addCommonArgs(), and instrument().
| bool llvm::instrumentor::InstrumentationOpportunity::Enabled = true |
Whether the opportunity is enabled.
Definition at line 424 of file Instrumentor.h.
| InstrumentationLocation llvm::instrumentor::InstrumentationOpportunity::IP |
The instrumentation location of the opportunity.
Definition at line 416 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 421 of file Instrumentor.h.
Referenced by addCommonArgs(), llvm::instrumentor::LoadIO::init(), and llvm::instrumentor::StoreIO::init().