#ifndef LLVM_SUPPORT_CALLSITE_H
#define LLVM_SUPPORT_CALLSITE_H
-#include "llvm/Attributes.h"
#include "llvm/ADT/PointerIntPair.h"
-#include "llvm/BasicBlock.h"
-#include "llvm/CallingConv.h"
-#include "llvm/Instructions.h"
+#include "llvm/IR/Attributes.h"
+#include "llvm/IR/BasicBlock.h"
+#include "llvm/IR/CallingConv.h"
+#include "llvm/IR/Instructions.h"
namespace llvm {
/// getAttributes/setAttributes - get or set the parameter attributes of
/// the call.
- const AttrListPtr &getAttributes() const {
+ const AttributeSet &getAttributes() const {
CALLSITE_DELEGATE_GETTER(getAttributes());
}
- void setAttributes(const AttrListPtr &PAL) {
+ void setAttributes(const AttributeSet &PAL) {
CALLSITE_DELEGATE_SETTER(setAttributes(PAL));
}
/// \brief Return true if this function has the given attribute.
- bool fnHasNoAliasAttr() const {
- CALLSITE_DELEGATE_GETTER(fnHasNoAliasAttr());
- }
- bool fnHasNoInlineAttr() const {
- CALLSITE_DELEGATE_GETTER(fnHasNoInlineAttr());
- }
- bool fnHasNoReturnAttr() const {
- CALLSITE_DELEGATE_GETTER(fnHasNoReturnAttr());
- }
- bool fnHasNoUnwindAttr() const {
- CALLSITE_DELEGATE_GETTER(fnHasNoUnwindAttr());
- }
- bool fnHasReadNoneAttr() const {
- CALLSITE_DELEGATE_GETTER(fnHasReadNoneAttr());
- }
- bool fnHasReadOnlyAttr() const {
- CALLSITE_DELEGATE_GETTER(fnHasReadOnlyAttr());
- }
- bool fnHasReturnsTwiceAttr() const {
- CALLSITE_DELEGATE_GETTER(fnHasReturnsTwiceAttr());
- }
- bool hasFnAttr(Attributes N) const {
- CALLSITE_DELEGATE_GETTER(hasFnAttr(N));
- }
-
- /// paramHas*Attr - whether the call or the callee has the given attribute.
- bool paramHasSExtAttr(unsigned i) const {
- CALLSITE_DELEGATE_GETTER(paramHasSExtAttr(i));
- }
- bool paramHasZExtAttr(unsigned i) const {
- CALLSITE_DELEGATE_GETTER(paramHasZExtAttr(i));
- }
- bool paramHasInRegAttr(unsigned i) const {
- CALLSITE_DELEGATE_GETTER(paramHasInRegAttr(i));
- }
- bool paramHasStructRetAttr(unsigned i) const {
- CALLSITE_DELEGATE_GETTER(paramHasStructRetAttr(i));
- }
- bool paramHasNestAttr(unsigned i) const {
- CALLSITE_DELEGATE_GETTER(paramHasNestAttr(i));
- }
- bool paramHasByValAttr(unsigned i) const {
- CALLSITE_DELEGATE_GETTER(paramHasByValAttr(i));
- }
- bool paramHasNoAliasAttr(unsigned i) const {
- CALLSITE_DELEGATE_GETTER(paramHasNoAliasAttr(i));
- }
- bool paramHasNoCaptureAttr(unsigned i) const {
- CALLSITE_DELEGATE_GETTER(paramHasNoCaptureAttr(i));
+ bool hasFnAttr(Attribute::AttrKind A) const {
+ CALLSITE_DELEGATE_GETTER(hasFnAttr(A));
}
- /// paramHasAttr - whether the call or the callee has the given attribute.
- bool paramHasAttr(uint16_t i, Attributes attr) const {
- CALLSITE_DELEGATE_GETTER(paramHasAttr(i, attr));
+ /// \brief Return true if the call or the callee has the given attribute.
+ bool paramHasAttr(unsigned i, Attribute::AttrKind A) const {
+ CALLSITE_DELEGATE_GETTER(paramHasAttr(i, A));
}
/// @brief Extract the alignment for a call or parameter (0=unknown).
bool doesNotAccessMemory() const {
CALLSITE_DELEGATE_GETTER(doesNotAccessMemory());
}
- void setDoesNotAccessMemory(bool doesNotAccessMemory = true) {
- CALLSITE_DELEGATE_SETTER(setDoesNotAccessMemory(doesNotAccessMemory));
+ void setDoesNotAccessMemory() {
+ CALLSITE_DELEGATE_SETTER(setDoesNotAccessMemory());
}
/// @brief Determine if the call does not access or only reads memory.
bool onlyReadsMemory() const {
CALLSITE_DELEGATE_GETTER(onlyReadsMemory());
}
- void setOnlyReadsMemory(bool onlyReadsMemory = true) {
- CALLSITE_DELEGATE_SETTER(setOnlyReadsMemory(onlyReadsMemory));
+ void setOnlyReadsMemory() {
+ CALLSITE_DELEGATE_SETTER(setOnlyReadsMemory());
}
/// @brief Determine if the call cannot return.
bool doesNotReturn() const {
CALLSITE_DELEGATE_GETTER(doesNotReturn());
}
- void setDoesNotReturn(bool doesNotReturn = true) {
- CALLSITE_DELEGATE_SETTER(setDoesNotReturn(doesNotReturn));
+ void setDoesNotReturn() {
+ CALLSITE_DELEGATE_SETTER(setDoesNotReturn());
}
/// @brief Determine if the call cannot unwind.
bool doesNotThrow() const {
CALLSITE_DELEGATE_GETTER(doesNotThrow());
}
- void setDoesNotThrow(bool doesNotThrow = true) {
- CALLSITE_DELEGATE_SETTER(setDoesNotThrow(doesNotThrow));
+ void setDoesNotThrow() {
+ CALLSITE_DELEGATE_SETTER(setDoesNotThrow());
}
#undef CALLSITE_DELEGATE_GETTER
/// @brief Determine whether this argument is not captured.
bool doesNotCapture(unsigned ArgNo) const {
- return paramHasNoCaptureAttr(ArgNo + 1);
+ return paramHasAttr(ArgNo + 1, Attribute::NoCapture);
}
/// @brief Determine whether this argument is passed by value.
bool isByValArgument(unsigned ArgNo) const {
- return paramHasByValAttr(ArgNo + 1);
+ return paramHasAttr(ArgNo + 1, Attribute::ByVal);
}
/// hasArgument - Returns true if this CallSite passes the given Value* as an