if (NumIdx > 0)
// This requires that the iterator points to contiguous memory.
- return getIndexedType(Ptr, (Value *const *)&*IdxBegin, NumIdx);
+ return getIndexedType(Ptr, &*IdxBegin, NumIdx);
else
return getIndexedType(Ptr, (Value *const*)0, NumIdx);
}
~CallInst();
- virtual CallInst *clone() const;
-
- /// Provide fast operand accessors
- DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
-
bool isTailCall() const { return SubclassData & 1; }
void setTailCall(bool isTC = true) {
SubclassData = (SubclassData & ~1) | unsigned(isTC);
}
+ virtual CallInst *clone() const;
+
+ /// Provide fast operand accessors
+ DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
+
/// getCallingConv/setCallingConv - Get or set the calling convention of this
/// function call.
unsigned getCallingConv() const { return SubclassData >> 1; }
///
const AttrListPtr &getAttributes() const { return AttributeList; }
- /// setAttributes - Sets the parameter attributes for this call.
+ /// setAttributes - Set the parameter attributes for this call.
+ ///
void setAttributes(const AttrListPtr &Attrs) { AttributeList = Attrs; }
/// addAttribute - adds the attribute to the list of attributes.
void removeAttribute(unsigned i, Attributes attr);
/// @brief Determine whether the call or the callee has the given attribute.
- bool paramHasAttr(unsigned i, unsigned attr) const;
+ bool paramHasAttr(unsigned i, Attributes attr) const;
/// @brief Extract the alignment for a call or parameter (0=unknown).
unsigned getParamAlignment(unsigned i) const {
/// @brief Determine if the call does not access memory.
bool doesNotAccessMemory() const {
- return paramHasAttr(0, Attribute::ReadNone);
+ return paramHasAttr(~0, Attribute::ReadNone);
}
void setDoesNotAccessMemory(bool NotAccessMemory = true) {
- if (NotAccessMemory) addAttribute(0, Attribute::ReadNone);
- else removeAttribute(0, Attribute::ReadNone);
+ if (NotAccessMemory) addAttribute(~0, Attribute::ReadNone);
+ else removeAttribute(~0, Attribute::ReadNone);
}
/// @brief Determine if the call does not access or only reads memory.
bool onlyReadsMemory() const {
- return doesNotAccessMemory() || paramHasAttr(0, Attribute::ReadOnly);
+ return doesNotAccessMemory() || paramHasAttr(~0, Attribute::ReadOnly);
}
void setOnlyReadsMemory(bool OnlyReadsMemory = true) {
- if (OnlyReadsMemory) addAttribute(0, Attribute::ReadOnly);
- else removeAttribute(0, Attribute::ReadOnly | Attribute::ReadNone);
+ if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly);
+ else removeAttribute(~0, Attribute::ReadOnly | Attribute::ReadNone);
}
/// @brief Determine if the call cannot return.
bool doesNotReturn() const {
- return paramHasAttr(0, Attribute::NoReturn);
+ return paramHasAttr(~0, Attribute::NoReturn);
}
void setDoesNotReturn(bool DoesNotReturn = true) {
- if (DoesNotReturn) addAttribute(0, Attribute::NoReturn);
- else removeAttribute(0, Attribute::NoReturn);
+ if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn);
+ else removeAttribute(~0, Attribute::NoReturn);
}
/// @brief Determine if the call cannot unwind.
bool doesNotThrow() const {
- return paramHasAttr(0, Attribute::NoUnwind);
+ return paramHasAttr(~0, Attribute::NoUnwind);
}
void setDoesNotThrow(bool DoesNotThrow = true) {
- if (DoesNotThrow) addAttribute(0, Attribute::NoUnwind);
- else removeAttribute(0, Attribute::NoUnwind);
+ if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind);
+ else removeAttribute(~0, Attribute::NoUnwind);
}
/// @brief Determine if the call returns a structure through first
return AttributeList.hasAttrSomewhere(Attribute::ByVal);
}
- /// getCalledFunction - Return the function being called by this instruction
- /// if it is a direct call. If it is a call through a function pointer,
- /// return null.
+ /// getCalledFunction - Return the function called, or null if this is an
+ /// indirect function invocation.
+ ///
Function *getCalledFunction() const {
return dyn_cast<Function>(getOperand(0));
}
///
void setAttributes(const AttrListPtr &Attrs) { AttributeList = Attrs; }
- /// @brief Determine whether the call or the callee has the given attribute.
- bool paramHasAttr(unsigned i, Attributes attr) const;
-
/// addAttribute - adds the attribute to the list of attributes.
void addAttribute(unsigned i, Attributes attr);
/// removeAttribute - removes the attribute from the list of attributes.
void removeAttribute(unsigned i, Attributes attr);
+ /// @brief Determine whether the call or the callee has the given attribute.
+ bool paramHasAttr(unsigned i, Attributes attr) const;
+
/// @brief Extract the alignment for a call or parameter (0=unknown).
unsigned getParamAlignment(unsigned i) const {
return AttributeList.getParamAlignment(i);
return paramHasAttr(0, Attribute::ReadNone);
}
void setDoesNotAccessMemory(bool NotAccessMemory = true) {
- if (NotAccessMemory) addAttribute(0, Attribute::ReadNone);
- else removeAttribute(0, Attribute::ReadNone);
+ if (NotAccessMemory) addAttribute(~0, Attribute::ReadNone);
+ else removeAttribute(~0, Attribute::ReadNone);
}
/// @brief Determine if the call does not access or only reads memory.
bool onlyReadsMemory() const {
- return doesNotAccessMemory() || paramHasAttr(0, Attribute::ReadOnly);
+ return doesNotAccessMemory() || paramHasAttr(~0, Attribute::ReadOnly);
}
void setOnlyReadsMemory(bool OnlyReadsMemory = true) {
- if (OnlyReadsMemory) addAttribute(0, Attribute::ReadOnly);
- else removeAttribute(0, Attribute::ReadOnly | Attribute::ReadNone);
+ if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly);
+ else removeAttribute(~0, Attribute::ReadOnly | Attribute::ReadNone);
}
/// @brief Determine if the call cannot return.
bool doesNotReturn() const {
- return paramHasAttr(0, Attribute::NoReturn);
+ return paramHasAttr(~0, Attribute::NoReturn);
}
void setDoesNotReturn(bool DoesNotReturn = true) {
- if (DoesNotReturn) addAttribute(0, Attribute::NoReturn);
- else removeAttribute(0, Attribute::NoReturn);
+ if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn);
+ else removeAttribute(~0, Attribute::NoReturn);
}
/// @brief Determine if the call cannot unwind.
bool doesNotThrow() const {
- return paramHasAttr(0, Attribute::NoUnwind);
+ return paramHasAttr(~0, Attribute::NoUnwind);
}
void setDoesNotThrow(bool DoesNotThrow = true) {
- if (DoesNotThrow) addAttribute(0, Attribute::NoUnwind);
- else removeAttribute(0, Attribute::NoUnwind);
+ if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind);
+ else removeAttribute(~0, Attribute::NoUnwind);
}
/// @brief Determine if the call returns a structure through first
return paramHasAttr(1, Attribute::StructRet);
}
+ /// @brief Determine if any call argument is an aggregate passed by value.
+ bool hasByValArgument() const {
+ return AttributeList.hasAttrSomewhere(Attribute::ByVal);
+ }
+
/// getCalledFunction - Return the function called, or null if this is an
/// indirect function invocation.
///
return dyn_cast<Function>(getOperand(0));
}
- // getCalledValue - Get a pointer to a function that is invoked by this inst.
- Value *getCalledValue() const { return getOperand(0); }
+ /// getCalledValue - Get a pointer to the function that is invoked by this
+ /// instruction
+ const Value *getCalledValue() const { return getOperand(0); }
+ Value *getCalledValue() { return getOperand(0); }
// get*Dest - Return the destination basic blocks...
BasicBlock *getNormalDest() const {