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

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.
FunctionTypecreateLLVMSignature (InstrumentationConfig &IConf, InstrumentorIRBuilderTy &IIRB, const DataLayout &DL, bool ForceIndirection)
 Create the type of the instrumentation function.
CallInstcreateLLVMCall (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.
InstrumentationOpportunityIO
 The instrumentation opportunity which it is linked to.
TypeRetTy = nullptr
 The return type of the instrumentation function.

Detailed Description

Helper to represent an instrumentation runtime function that is related to an instrumentation opportunity.

Definition at line 104 of file Instrumentor.h.

Constructor & Destructor Documentation

◆ IRTCallDescription()

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.

Member Function Documentation

◆ createCBodies()

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().

◆ createCSignature()

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().

◆ createLLVMCall()

◆ createLLVMSignature()

◆ isPotentiallyIndirect()

bool llvm::instrumentor::IRTCallDescription::isPotentiallyIndirect ( IRTArg & IRTA) const
inline

◆ isReplacable()

bool llvm::instrumentor::IRTCallDescription::isReplacable ( IRTArg & IRTA) const
inline

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().

Member Data Documentation

◆ IO

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().

◆ MightRequireIndirection

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().

◆ NumReplaceableArgs

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().

◆ RequiresIndirection

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().

◆ RetTy

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().


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