26 #ifndef LLVM_IR_CALLSITE_H
27 #define LLVM_IR_CALLSITE_H
40 template <
typename FunTy =
const Function,
42 typename ValTy =
const Value,
43 typename UserTy =
const User,
44 typename InstrTy =
const Instruction,
45 typename CallTy =
const CallInst,
46 typename InvokeTy =
const InvokeInst,
64 if (InstrTy *II = dyn_cast<InstrTy>(V)) {
67 else if (II->getOpcode() == Instruction::Invoke)
141 &&
"Argument # out of range!");
154 return (*this)->op_begin();
157 IterTy
arg_end()
const {
return (*this)->op_end() - getArgumentEndOffset(); }
183 #define CALLSITE_DELEGATE_GETTER(METHOD) \
184 InstrTy *II = getInstruction(); \
186 ? cast<CallInst>(II)->METHOD \
187 : cast<InvokeInst>(II)->METHOD
189 #define CALLSITE_DELEGATE_SETTER(METHOD) \
190 InstrTy *II = getInstruction(); \
192 cast<CallInst>(II)->METHOD; \
194 cast<InvokeInst>(II)->METHOD
318 #undef CALLSITE_DELEGATE_GETTER
319 #undef CALLSITE_DELEGATE_SETTER
364 getType()->getPointerAddressSpace() == 0)
375 if (AI->get() == Arg)
381 unsigned getArgumentEndOffset()
const {
388 IterTy getCallee()
const {
397 Instruction, CallInst, InvokeInst,
bool hasArgument(const Value *Arg) const
hasArgument - Returns true if this CallSite passes the given Value* as an argument to the called func...
CallSiteBase(InvokeTy *II)
bool hasInAllocaArgument() const
Determine if there are is an inalloca argument.
ImmutableCallSite(const Value *V)
bool isTailCall() const
Tests if this call site is marked as a tail call.
ImmutableCallSite(const Instruction *II)
CallSite(Instruction *II)
ValTy * getArgument(unsigned ArgNo) const
unsigned getArgumentNo(const Use *U) const
Given a use for an argument, get the argument number that corresponds to it.
bool isCallee(const Use *U) const
Determine whether this Use is the callee operand's Use.
InstrTy * getInstruction() const
#define CALLSITE_DELEGATE_GETTER(METHOD)
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
CallInst - This class represents a function call, abstracting a target machine's calling convention...
BBTy * getParent() const
Get the basic block containing the call site.
void setOnlyReadsMemory()
void setAttributes(const AttributeSet &PAL)
FunTy * getCaller() const
getCaller - Return the caller function for this call site
IterTy arg_iterator
arg_iterator - The type of iterator to use when looping over actual arguments at this call site...
bool isByValOrInAllocaArgument(unsigned ArgNo) const
Determine whether this argument is passed by value or in an alloca.
bool operator==(const CallSite &CS) const
A Use represents the edge between a Value definition and its users.
bool doesNotThrow() const
Determine if the call cannot unwind.
bool doesNotReturn() const
Determine if the call cannot return.
This file contains the simple types necessary to represent the attributes associated with functions a...
uint64_t getDereferenceableBytes(uint16_t i) const
Extract the number of dereferenceable bytes for a call or parameter (0=unknown).
bool hasFnAttr(Attribute::AttrKind A) const
Return true if this function has the given attribute.
uint16_t getParamAlignment(uint16_t i) const
Extract the alignment for a call or parameter (0=unknown).
Function does not access memory.
Function creates no aliases of pointer.
void setOnlyAccessesArgMemory()
iterator_range< IterTy > args() const
FunctionType - Class to represent function types.
ValTy * getCalledValue() const
getCalledValue - Return the pointer to function that is being called.
unsigned getNumArgOperands() const
void setCallingConv(CallingConv::ID CC)
PointerIntPair< InstrTy *, 1, bool > I
bool doesNotAccessMemory() const
Determine if the call does not access memory.
bool onlyReadsMemory(unsigned ArgNo) const
bool doesNotAccessMemory(unsigned ArgNo) const
The instances of the Type class are immutable: once they are created, they are never changed...
unsigned getArgumentNo(Value::const_user_iterator I) const
Given a value use iterator, returns the argument that corresponds to it.
FunTy * getCalledFunction() const
getCalledFunction - Return the function being called if this is a direct call, otherwise return null ...
void setIsNoInline(bool Value=true)
bool isByValArgument(unsigned ArgNo) const
Determine whether this argument is passed by value.
Pass structure in an alloca.
void setDoesNotAccessMemory()
void mutateFunctionType(FunctionType *Ty) const
uint64_t getDereferenceableOrNullBytes(uint16_t i) const
Extract the number of dereferenceable_or_null bytes for a call or parameter (0=unknown).
ImmutableCallSite(CallSite CS)
ValTy * getArgOperand(unsigned i) const
Pointer is known to be not null.
bool operator!=(const CallSite &CS) const
bool isMustTailCall() const
Tests if this call site must be tail call optimized.
PointerTy getPointer() const
InstrTy * operator->() const
bool paramHasAttr(unsigned i, Attribute::AttrKind A) const
Return true if the call or the callee has the given attribute.
ImmutableCallSite(const InvokeInst *II)
bool isCallee(Value::const_user_iterator UI) const
isCallee - Determine whether the passed iterator points to the callee operand's Use.
bool isNoBuiltin() const
Return true if the call should not be treated as a call to a builtin.
unsigned arg_size() const
bool isInAllocaArgument(unsigned ArgNo) const
Determine whether this argument is passed in an alloca.
bool isNoInline() const
Return true if the call should not be inlined.
A range adaptor for a pair of iterators.
ImmutableCallSite(const CallInst *CI)
Function only reads from memory.
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
bool isReturnNonNull() const
Return true if the return value is known to be not null.
user_iterator_impl< const User > const_user_iterator
bool doesNotCapture(unsigned ArgNo) const
Determine whether this argument is not captured.
#define CALLSITE_DELEGATE_SETTER(METHOD)
void setCalledFunction(Value *V)
setCalledFunction - Set the callee to the specified value.
ImmutableCallSite - establish a view to a call site for examination.
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - get or set the calling convention of the call.
const AttributeSet & getAttributes() const
getAttributes/setAttributes - get or set the parameter attributes of the call.
bool operator<(const CallSite &CS) const
FunctionType * getFunctionType() const
Type * getType() const
getType - Return the type of the instruction that generated this call site
void setArgument(unsigned ArgNo, Value *newVal)
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
InvokeInst - Invoke instruction.
IterTy arg_begin() const
arg_begin/arg_end - Return iterators corresponding to the actual argument list for a call site...
bool isInvoke() const
isInvoke - true if a InvokeInst is enclosed.
bool isCall() const
isCall - true if a CallInst is enclosed.
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...
const Use * const_op_iterator
bool onlyAccessesArgMemory() const
Determine if the call can access memmory only using pointers based on its arguments.