class AbstractCallSite
Declaration
class AbstractCallSite { /* full declaration omitted */ };
Description
AbstractCallSite An abstract call site is a wrapper that allows to treat direct, indirect, and callback calls the same. If an abstract call site represents a direct or indirect call site it behaves like a stripped down version of a normal call site object. The abstract call site can also represent a callback call, thus the fact that the initially called function (=broker) may invoke a third one (=callback callee). In this case, the abstract call site hides the middle man, hence the broker function. The result is a representation of the callback call, inside the broker, but in the context of the original call to the broker. There are up to three functions involved when we talk about callback call sites. The caller (1), which invokes the broker function. The broker function (2), that will invoke the callee zero or more times. And finally the callee (3), which is the target of the callback call. The abstract call site will handle the mapping from parameters to arguments depending on the semantic of the broker function. However, it is important to note that the mapping is often partial. Thus, some arguments of the call/invoke instruction are mapped to parameters of the callee while others are not.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:50
Member Variables
- private llvm::CallBase* CB
- The underlying call site: caller -> callee, if this is a direct or indirect call site caller -> broker function, if this is a callback call site
- private llvm::AbstractCallSite::CallbackInfo CI
- The encoding of a callback with regards to the underlying instruction.
Method Overview
- public AbstractCallSite(const llvm::Use * U)
- public llvm::Value * getCallArgOperand(unsigned int ArgNo) const
- public llvm::Value * getCallArgOperand(llvm::Argument & Arg) const
- public int getCallArgOperandNo(unsigned int ArgNo) const
- public int getCallArgOperandNo(llvm::Argument & Arg) const
- public int getCallArgOperandNoForCallee() const
- public static void getCallbackUses(const llvm::CallBase & CB, SmallVectorImpl<const llvm::Use *> & CallbackUses)
- public llvm::Function * getCalledFunction() const
- public llvm::Value * getCalledOperand() const
- public const llvm::Use & getCalleeUseForCallback() const
- public llvm::CallBase * getInstruction() const
- public unsigned int getNumArgOperands() const
- public bool isCallbackCall() const
- public bool isCallee(const llvm::Use * U) const
- public bool isCallee(Value::const_user_iterator UI) const
- public bool isDirectCall() const
- public bool isIndirectCall() const
- public bool operator bool() const
Methods
¶AbstractCallSite(const llvm::Use* U)
AbstractCallSite(const llvm::Use* U)
Description
Sole constructor for abstract call sites (ACS). An abstract call site can only be constructed through a llvm::Use because each operand (=use) of an instruction could potentially be a different abstract call site. Furthermore, even if the value of the llvm::Use is the same, and the user is as well, the abstract call sites might not be. If a use is not associated with an abstract call site the constructed ACS will evaluate to false if converted to a boolean. If the use is the callee use of a call or invoke instruction, the constructed abstract call site will behave as a llvm::CallSite would. If the use is not a callee use of a call or invoke instruction, the callback metadata is used to determine the argument < -> parameter mapping as well as the callee of the abstract call site.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:98
Parameters
- const llvm::Use* U
¶llvm::Value* getCallArgOperand(
unsigned int ArgNo) const
llvm::Value* getCallArgOperand(
unsigned int ArgNo) const
Description
Return the operand of the underlying instruction associated with the function parameter number @p ArgNo or nullptr if there is none.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:183
Parameters
- unsigned int ArgNo
¶llvm::Value* getCallArgOperand(
llvm::Argument& Arg) const
llvm::Value* getCallArgOperand(
llvm::Argument& Arg) const
Description
Return the operand of the underlying instruction associated with @p Arg.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:177
Parameters
- llvm::Argument& Arg
¶int getCallArgOperandNo(unsigned int ArgNo) const
int getCallArgOperandNo(unsigned int ArgNo) const
Description
Return the operand index of the underlying instruction associated with the function parameter number @p ArgNo or -1 if there is none.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:169
Parameters
- unsigned int ArgNo
¶int getCallArgOperandNo(llvm::Argument& Arg) const
int getCallArgOperandNo(llvm::Argument& Arg) const
Description
Return the operand index of the underlying instruction associated with @p Arg.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:163
Parameters
- llvm::Argument& Arg
¶int getCallArgOperandNoForCallee() const
int getCallArgOperandNoForCallee() const
Description
Return the operand index of the underlying instruction associated with the callee of this ACS. Only valid for callback calls!
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:194
¶static void getCallbackUses(
const llvm::CallBase& CB,
SmallVectorImpl<const llvm::Use*>&
CallbackUses)
static void getCallbackUses(
const llvm::CallBase& CB,
SmallVectorImpl<const llvm::Use*>&
CallbackUses)
Description
Add operand uses of \p CB that represent callback uses into\p CallbackUses. All uses added to \p CallbackUses can be used to create abstract call sites for which AbstractCallSite::isCallbackCall() will return true.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:105
Parameters
- const llvm::CallBase& CB
- SmallVectorImpl<const llvm::Use*>& CallbackUses
¶llvm::Function* getCalledFunction() const
llvm::Function* getCalledFunction() const
Description
Return the function being called if this is a direct call, otherwise return null (if it's an indirect call).
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:218
¶llvm::Value* getCalledOperand() const
llvm::Value* getCalledOperand() const
Description
Return the pointer to function that is being called.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:210
¶const llvm::Use& getCalleeUseForCallback() const
const llvm::Use& getCalleeUseForCallback() const
Description
Return the use of the callee value in the underlying instruction. Only valid for callback calls!
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:202
¶llvm::CallBase* getInstruction() const
llvm::CallBase* getInstruction() const
Description
Return the underlying instruction.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:112
¶unsigned int getNumArgOperands() const
unsigned int getNumArgOperands() const
Description
Return the number of parameters of the callee.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:154
¶bool isCallbackCall() const
bool isCallbackCall() const
Description
Return true if this ACS represents a callback call.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:125
¶bool isCallee(const llvm::Use* U) const
bool isCallee(const llvm::Use* U) const
Description
Return true if @p U is the use that defines the callee of this ACS.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:137
Parameters
- const llvm::Use* U
¶bool isCallee(Value::const_user_iterator UI) const
bool isCallee(Value::const_user_iterator UI) const
Description
Return true if @p UI is the use that defines the callee of this ACS.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:132
Parameters
¶bool isDirectCall() const
bool isDirectCall() const
Description
Return true if this ACS represents a direct call.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:115
¶bool isIndirectCall() const
bool isIndirectCall() const
Description
Return true if this ACS represents an indirect call.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:120
¶bool operator bool() const
bool operator bool() const
Description
Conversion operator to conveniently check for a valid/initialized ACS.
Declared at: llvm/include/llvm/IR/AbstractCallSite.h:109