14#ifndef LLVM_IR_ABSTRACTCALLSITE_H
15#define LLVM_IR_ABSTRACTCALLSITE_H
111 explicit operator bool()
const {
return CB !=
nullptr; }
130 return !CI.ParameterEncoding.empty();
141 return CB->isCallee(U);
143 assert(!CI.ParameterEncoding.empty() &&
144 "Callback without parameter encoding!");
149 if (CE->hasOneUse() && CE->isCast())
150 U = &*CE->use_begin();
152 return (
int)CB->getArgOperandNo(U) == CI.ParameterEncoding[0];
158 return CB->arg_size();
160 return CI.ParameterEncoding.size() - 1;
175 return CI.ParameterEncoding[ArgNo + 1];
187 return CB->getArgOperand(ArgNo);
189 return CI.ParameterEncoding[ArgNo + 1] >= 0
190 ? CB->getArgOperand(CI.ParameterEncoding[ArgNo + 1])
198 assert(CI.ParameterEncoding.size() && CI.ParameterEncoding[0] >= 0);
199 return CI.ParameterEncoding[0];
206 assert(CalleeArgIdx >= 0 &&
214 return CB->getCalledOperand();
227template <
typename UnaryFunction>
231 for (
const Use *U : CallbackUses) {
239template <
typename UnaryFunction>
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
int getCallArgOperandNoForCallee() const
Return the operand index of the underlying instruction associated with the callee of this ACS.
bool isCallee(const Use *U) const
Return true if U is the use that defines the callee of this ACS.
CallBase * getInstruction() const
Return the underlying instruction.
bool isCallbackCall() const
Return true if this ACS represents a callback call.
bool isDirectCall() const
Return true if this ACS represents a direct call.
bool isIndirectCall() const
Return true if this ACS represents an indirect call.
const Use & getCalleeUseForCallback() const
Return the use of the callee value in the underlying instruction.
static LLVM_ABI void getCallbackUses(const CallBase &CB, SmallVectorImpl< const Use * > &CallbackUses)
Add operand uses of CB that represent callback uses into CallbackUses.
LLVM_ABI AbstractCallSite(const Use *U)
Sole constructor for abstract call sites (ACS).
int getCallArgOperandNo(unsigned ArgNo) const
Return the operand index of the underlying instruction associated with the function parameter number ...
bool isCallee(Value::const_user_iterator UI) const
Return true if UI is the use that defines the callee of this ACS.
Value * getCallArgOperand(Argument &Arg) const
Return the operand of the underlying instruction associated with Arg.
Value * getCallArgOperand(unsigned ArgNo) const
Return the operand of the underlying instruction associated with the function parameter number ArgNo ...
int getCallArgOperandNo(Argument &Arg) const
Return the operand index of the underlying instruction associated with Arg.
Value * getCalledOperand() const
Return the pointer to function that is being called.
unsigned getNumArgOperands() const
Return the number of parameters of the callee.
Function * getCalledFunction() const
Return the function being called if this is a direct call, otherwise return null (if it's an indirect...
This class represents an incoming formal argument to a Function.
unsigned getArgNo() const
Return the index of this formal argument in its containing function.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A Use represents the edge between a Value definition and its users.
const Use & getOperandUse(unsigned i) const
LLVM Value Representation.
user_iterator_impl< const User > const_user_iterator
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
void forEachCallbackCallSite(const CallBase &CB, UnaryFunction Func)
Apply function Func to each CB's callback call site.
void forEachCallbackFunction(const CallBase &CB, UnaryFunction Func)
Apply function Func to each CB's callback function.
The encoding of a callback with regards to the underlying instruction.
SmallVector< int, 0 > ParameterEncodingTy
For direct/indirect calls the parameter encoding is empty.
ParameterEncodingTy ParameterEncoding