|
LLVM 23.0.0git
|
Helper to represent an instrumentation runtime function that is related to an instrumentation opportunity. More...
#include "llvm/Transforms/IPO/Instrumentor.h"
Public Member Functions | |
| IRTCallDescription (InstrumentationOpportunity &IO, Type *RetTy=nullptr) | |
Construct an instrumentation function description linked to the IO instrumentation opportunity and RetTy return type. | |
| FunctionType * | createLLVMSignature (InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB, const DataLayout &DL, bool ForceIndirection) |
| Create the type of the instrumentation function. | |
| CallInst * | createLLVMCall (Value *&V, InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB, const DataLayout &DL, InstrumentationCaches &ICaches) |
| Create a call instruction that calls to the instrumentation function and passes the corresponding arguments. | |
| std::pair< std::string, std::string > | createCSignature (const InstrumentationConfig &IConf) const |
| Create a string representation of the function declaration in C. | |
| std::pair< std::string, std::string > | createCBodies () const |
| Create a string representation of the function definition in C. | |
| bool | isReplacable (IRTArg &IRTA) const |
Return whether the IRTA argument can be replaced. | |
| bool | isPotentiallyIndirect (IRTArg &IRTA) const |
| Return whether the function may have any indirect argument. | |
Public Attributes | |
| bool | RequiresIndirection = false |
| Whether the function requires indirection in some argument. | |
| bool | MightRequireIndirection = false |
| Whether any argument may require indirection. | |
| unsigned | NumReplaceableArgs = 0 |
| The number of arguments that can be replaced. | |
| InstrumentationOpportunity & | IO |
| The instrumentation opportunity which it is linked to. | |
| Type * | RetTy = nullptr |
| The return type of the instrumentation function. | |
Helper to represent an instrumentation runtime function that is related to an instrumentation opportunity.
Definition at line 104 of file Instrumentor.h.
| IRTCallDescription::IRTCallDescription | ( | InstrumentationOpportunity & | IO, |
| Type * | RetTy = nullptr ) |
Construct an instrumentation function description linked to the IO instrumentation opportunity and RetTy return type.
Definition at line 378 of file Instrumentor.cpp.
References if(), IO, MightRequireIndirection, NumReplaceableArgs, RequiresIndirection, and RetTy.
| std::pair< std::string, std::string > llvm::instrumentor::IRTCallDescription::createCBodies | ( | ) | const |
Create a string representation of the function definition in C.
The function body implements a stub and only prints the passed arguments. Two strings are returned: the function definition with direct arguments and the function with any indirect argument.
Definition at line 70 of file InstrumentorStubPrinter.cpp.
References llvm::First, llvm::instrumentor::getPrintfFormatString(), llvm::instrumentor::IRTArg::INDIRECT_HAS_SIZE, IO, isPotentiallyIndirect(), NumReplaceableArgs, llvm::instrumentor::IRTArg::REPLACABLE, and RetTy.
Referenced by llvm::instrumentor::printRuntimeStub().
| std::pair< std::string, std::string > llvm::instrumentor::IRTCallDescription::createCSignature | ( | const InstrumentationConfig & | IConf | ) | const |
Create a string representation of the function declaration in C.
Two strings are returned: the function definition with direct arguments and the function with any indirect argument.
Definition at line 124 of file InstrumentorStubPrinter.cpp.
References assert(), llvm::instrumentor::getAsCType(), llvm::instrumentor::InstrumentationConfig::getRTName(), llvm::instrumentor::IRTArg::INDIRECT_HAS_SIZE, IO, isPotentiallyIndirect(), llvm::join(), MightRequireIndirection, NumReplaceableArgs, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::instrumentor::IRTArg::REPLACABLE, RequiresIndirection, and RetTy.
Referenced by llvm::instrumentor::printRuntimeStub().
| CallInst * IRTCallDescription::createLLVMCall | ( | Value *& | V, |
| InstrumentationConfig & | IConf, | ||
| InstrumentorIRBuilderTy & | IIRB, | ||
| const DataLayout & | DL, | ||
| InstrumentationCaches & | ICaches ) |
Create a call instruction that calls to the instrumentation function and passes the corresponding arguments.
Definition at line 420 of file Instrumentor.cpp.
References assert(), createLLVMSignature(), llvm::instrumentor::InstrumentorIRBuilderTy::Ctx, llvm::LLVMContext::diagnose(), llvm::instrumentor::InstrumentationCaches::DirectArgCache, DL, llvm::DS_Warning, llvm::instrumentor::InstrumentorIRBuilderTy::Epoch, llvm::Attribute::get(), llvm::instrumentor::InstrumentorIRBuilderTy::getAlloca(), llvm::Constant::getNullValue(), llvm::instrumentor::InstrumentationConfig::getRTName(), llvm::GlobalValue::getType(), I, llvm::instrumentor::IRTArg::INDIRECT_HAS_SIZE, llvm::instrumentor::InstrumentationCaches::IndirectArgCache, llvm::SmallVectorImpl< T >::insert(), IO, llvm::instrumentor::InstrumentorIRBuilderTy::IRB, isPotentiallyIndirect(), isReplacable(), llvm::Offset, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::instrumentor::IRTArg::REPLACABLE_CUSTOM, and RequiresIndirection.
Referenced by llvm::instrumentor::InstrumentationOpportunity::instrument().
| FunctionType * IRTCallDescription::createLLVMSignature | ( | InstrumentationConfig & | IConf, |
| InstrumentorIRBuilderTy & | IIRB, | ||
| const DataLayout & | DL, | ||
| bool | ForceIndirection ) |
Create the type of the instrumentation function.
Definition at line 391 of file Instrumentor.cpp.
References assert(), DL, llvm::FunctionType::get(), llvm::instrumentor::IRTArg::INDIRECT_HAS_SIZE, llvm::instrumentor::InstrumentorIRBuilderTy::Int32Ty, IO, isPotentiallyIndirect(), MightRequireIndirection, NumReplaceableArgs, llvm::instrumentor::InstrumentorIRBuilderTy::PtrTy, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::instrumentor::IRTArg::REPLACABLE, RequiresIndirection, RetTy, and llvm::instrumentor::InstrumentorIRBuilderTy::VoidTy.
Referenced by createLLVMCall().
Return whether the function may have any indirect argument.
Definition at line 139 of file Instrumentor.h.
References llvm::instrumentor::IRTArg::Flags, NumReplaceableArgs, llvm::instrumentor::IRTArg::POTENTIALLY_INDIRECT, and llvm::instrumentor::IRTArg::REPLACABLE.
Referenced by createCBodies(), createCSignature(), createLLVMCall(), and createLLVMSignature().
Return whether the IRTA argument can be replaced.
Definition at line 134 of file Instrumentor.h.
References llvm::instrumentor::IRTArg::Flags, llvm::instrumentor::IRTArg::REPLACABLE, and llvm::instrumentor::IRTArg::REPLACABLE_CUSTOM.
Referenced by createLLVMCall().
| InstrumentationOpportunity& llvm::instrumentor::IRTCallDescription::IO |
The instrumentation opportunity which it is linked to.
Definition at line 154 of file Instrumentor.h.
Referenced by createCBodies(), createCSignature(), createLLVMCall(), createLLVMSignature(), and IRTCallDescription().
| bool llvm::instrumentor::IRTCallDescription::MightRequireIndirection = false |
Whether any argument may require indirection.
Definition at line 148 of file Instrumentor.h.
Referenced by createCSignature(), createLLVMSignature(), and IRTCallDescription().
| unsigned llvm::instrumentor::IRTCallDescription::NumReplaceableArgs = 0 |
The number of arguments that can be replaced.
Definition at line 151 of file Instrumentor.h.
Referenced by createCBodies(), createCSignature(), createLLVMSignature(), IRTCallDescription(), and isPotentiallyIndirect().
| bool llvm::instrumentor::IRTCallDescription::RequiresIndirection = false |
Whether the function requires indirection in some argument.
Definition at line 145 of file Instrumentor.h.
Referenced by createCSignature(), createLLVMCall(), createLLVMSignature(), and IRTCallDescription().
| Type* llvm::instrumentor::IRTCallDescription::RetTy = nullptr |
The return type of the instrumentation function.
Definition at line 157 of file Instrumentor.h.
Referenced by createCBodies(), createCSignature(), createLLVMSignature(), and IRTCallDescription().