26 #ifndef LLVM_SUPPORT_CALLSITE_H
27 #define LLVM_SUPPORT_CALLSITE_H
39 template <
typename FunTy =
const Function,
40 typename ValTy =
const Value,
41 typename UserTy =
const User,
42 typename InstrTy =
const Instruction,
43 typename CallTy =
const CallInst,
44 typename InvokeTy =
const InvokeInst,
61 if (InstrTy *II = dyn_cast<InstrTy>(V)) {
64 else if (II->getOpcode() == Instruction::Invoke)
108 return getCallee() == &UI.
getUse();
127 &&
"Argument # out of range!");
140 return (*this)->op_begin();
143 IterTy
arg_end()
const {
return (*this)->op_end() - getArgumentEndOffset(); }
155 #define CALLSITE_DELEGATE_GETTER(METHOD) \
156 InstrTy *II = getInstruction(); \
158 ? cast<CallInst>(II)->METHOD \
159 : cast<InvokeInst>(II)->METHOD
161 #define CALLSITE_DELEGATE_SETTER(METHOD) \
162 InstrTy *II = getInstruction(); \
164 cast<CallInst>(II)->METHOD; \
166 cast<InvokeInst>(II)->METHOD
247 #undef CALLSITE_DELEGATE_GETTER
248 #undef CALLSITE_DELEGATE_SETTER
274 if (AI->get() == Arg)
280 unsigned getArgumentEndOffset()
const {
287 IterTy getCallee()
const {
296 CallInst, InvokeInst, User::op_iterator> {
bool hasArgument(const Value *Arg) const
bool isCallee(value_use_iterator< UserTy > UI) const
ImmutableCallSite(const Value *V)
ImmutableCallSite(const Instruction *II)
const AttributeSet & getAttributes() const
CallSite(Instruction *II)
unsigned arg_size() const
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
#define CALLSITE_DELEGATE_GETTER(METHOD)
void setIsNoInline(bool Value=true)
void setCalledFunction(Value *V)
void setArgument(unsigned ArgNo, Value *newVal)
bool doesNotReturn() const
Determine if the call cannot return.
bool onlyReadsMemory(unsigned ArgNo) const
PointerIntPair< InstrTy *, 1, bool > I
ValTy * getArgument(unsigned ArgNo) const
InstrTy * operator->() const
bool operator==(const CallSite &CS) const
FunTy * getCaller() const
This file contains the simple types necessary to represent the attributes associated with functions a...
unsigned getArgumentNo(value_use_iterator< UserTy > I) const
void setOnlyReadsMemory()
ID
LLVM Calling Convention Representation.
Function does not access memory.
Function creates no aliases of pointer.
CallingConv::ID getCallingConv() const
ValTy * getCalledValue() const
uint16_t getParamAlignment(uint16_t i) const
Extract the alignment for a call or parameter (0=unknown).
InstrTy * getInstruction() const
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
ImmutableCallSite(CallSite CS)
bool isNoBuiltin() const
Return true if the call should not be treated as a call to a builtin.
bool operator!=(const CallSite &CS) const
PointerTy getPointer() const
bool doesNotThrow() const
Determine if the call cannot unwind.
bool doesNotAccessMemory() const
Determine if the call does not access memory.
bool isByValArgument(unsigned ArgNo) const
Determine whether this argument is passed by value.
ImmutableCallSite(const InvokeInst *II)
bool doesNotCapture(unsigned ArgNo) const
Determine whether this argument is not captured.
ImmutableCallSite(const CallInst *CI)
Function only reads from memory.
void setCallingConv(CallingConv::ID CC)
#define CALLSITE_DELEGATE_SETTER(METHOD)
void setDoesNotAccessMemory()
#define LLVM_EXPLICIT
Expands to explicit on compilers which support explicit conversion operators. Otherwise expands to no...
bool hasFnAttr(Attribute::AttrKind A) const
Return true if this function has the given attribute.
ImmutableCallSite - establish a view to a call site for examination.
void setAttributes(const AttributeSet &PAL)
bool isNoInline() const
Return true if the call should not be inlined.
bool paramHasAttr(unsigned i, Attribute::AttrKind A) const
Return true if the call or the callee has the given attribute.
CallSiteBase(InvokeTy *II)
bool operator<(const CallSite &CS) const
LLVM Value Representation.
bool doesNotAccessMemory(unsigned ArgNo) const
FunTy * getCalledFunction() const
const Use * const_op_iterator