#include "llvm/Instruction.h"
#include "llvm/BasicBlock.h"
+#include "llvm/ParameterAttributes.h"
namespace llvm {
CallSite() : I(0) {}
CallSite(CallInst *CI) : I(reinterpret_cast<Instruction*>(CI)) {}
CallSite(InvokeInst *II) : I(reinterpret_cast<Instruction*>(II)) {}
+ CallSite(Instruction *C);
CallSite(const CallSite &CS) : I(CS.I) {}
CallSite &operator=(const CallSite &CS) { I = CS.I; return *this; }
void setParamAttrs(const ParamAttrsList *PAL);
/// paramHasAttr - whether the call or the callee has the given attribute.
- bool paramHasAttr(uint16_t i, unsigned attr) const;
+ bool paramHasAttr(uint16_t i, ParameterAttributes attr) const;
/// @brief Determine if the call does not access memory.
bool doesNotAccessMemory() const;
return *(arg_begin()+ArgNo);
}
+ void setArgument(unsigned ArgNo, Value* newVal) {
+ assert(I && "Not a call or invoke instruction!");
+ assert(arg_begin() + ArgNo < arg_end() && "Argument # out of range!");
+ if (I->getOpcode() == Instruction::Call)
+ I->setOperand(ArgNo+1, newVal); // Skip Function
+ else
+ I->setOperand(ArgNo+3, newVal); // Skip Function, BB, BB
+ }
+
/// arg_iterator - The type of iterator to use when looping over actual
/// arguments at this call site...
typedef User::op_iterator arg_iterator;