/// \brief Return an AttributeSet with the specified parameters in it.
static AttributeSet get(LLVMContext &C, ArrayRef<AttributeSet> Attrs);
static AttributeSet get(LLVMContext &C, unsigned Index,
- ArrayRef<Attribute::AttrKind> Kind);
+ ArrayRef<Attribute::AttrKind> Kinds);
static AttributeSet get(LLVMContext &C, unsigned Index, const AttrBuilder &B);
/// \brief Add an attribute to the attribute set at the given index. Because
/// attribute sets are immutable, this returns a new set.
AttributeSet addAttribute(LLVMContext &C, unsigned Index,
- Attribute::AttrKind Attr) const;
+ Attribute::AttrKind Kind) const;
/// \brief Add an attribute to the attribute set at the given index. Because
/// attribute sets are immutable, this returns a new set.
- AttributeSet addAttribute(LLVMContext &C, unsigned Index,
- StringRef Kind) const;
- AttributeSet addAttribute(LLVMContext &C, unsigned Index,
- StringRef Kind, StringRef Value) const;
+ AttributeSet addAttribute(LLVMContext &C, unsigned Index, StringRef Kind,
+ StringRef Value = StringRef()) const;
/// Add an attribute to the attribute set at the given indices. Because
/// attribute sets are immutable, this returns a new set.
/// attribute list. Because attribute lists are immutable, this returns the
/// new list.
AttributeSet removeAttribute(LLVMContext &C, unsigned Index,
- Attribute::AttrKind Attr) const;
+ Attribute::AttrKind Kind) const;
/// \brief Remove the specified attributes at the specified index from this
/// attribute list. Because attribute lists are immutable, this returns the
/// \brief Return true if the specified attribute is set for at least one
/// parameter or for the return value.
- bool hasAttrSomewhere(Attribute::AttrKind Attr) const;
+ bool hasAttrSomewhere(Attribute::AttrKind Kind) const;
/// \brief Return the attribute object that exists at the given index.
Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const;
CALLSITE_DELEGATE_SETTER(setAttributes(PAL));
}
- void addAttribute(unsigned i, Attribute::AttrKind attr) {
- CALLSITE_DELEGATE_SETTER(addAttribute(i, attr));
+ void addAttribute(unsigned i, Attribute::AttrKind Kind) {
+ CALLSITE_DELEGATE_SETTER(addAttribute(i, Kind));
}
void addAttribute(unsigned i, StringRef Kind, StringRef Value) {
CALLSITE_DELEGATE_SETTER(addAttribute(i, Kind, Value));
}
- void removeAttribute(unsigned i, Attribute::AttrKind attr) {
- CALLSITE_DELEGATE_SETTER(removeAttribute(i, attr));
+ void removeAttribute(unsigned i, Attribute::AttrKind Kind) {
+ CALLSITE_DELEGATE_SETTER(removeAttribute(i, Kind));
}
- void removeAttribute(unsigned i, Attribute attr) {
- CALLSITE_DELEGATE_SETTER(removeAttribute(i, attr));
+ void removeAttribute(unsigned i, Attribute Attr) {
+ CALLSITE_DELEGATE_SETTER(removeAttribute(i, Attr));
}
/// \brief Return true if this function has the given attribute.
- bool hasFnAttr(Attribute::AttrKind A) const {
- CALLSITE_DELEGATE_GETTER(hasFnAttr(A));
+ bool hasFnAttr(Attribute::AttrKind Kind) const {
+ CALLSITE_DELEGATE_GETTER(hasFnAttr(Kind));
}
/// \brief Return true if this function has the given attribute.
- bool hasFnAttr(StringRef A) const {
- CALLSITE_DELEGATE_GETTER(hasFnAttr(A));
+ bool hasFnAttr(StringRef Kind) const {
+ CALLSITE_DELEGATE_GETTER(hasFnAttr(Kind));
}
/// \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));
+ bool paramHasAttr(unsigned i, Attribute::AttrKind Kind) const {
+ CALLSITE_DELEGATE_GETTER(paramHasAttr(i, Kind));
}
/// \brief Return true if the data operand at index \p i directly or
/// in the attribute set attached to this instruction, while operand bundle
/// operands may have some attributes implied by the type of its containing
/// operand bundle.
- bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind A) const {
- CALLSITE_DELEGATE_GETTER(dataOperandHasImpliedAttr(i, A));
+ bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const {
+ CALLSITE_DELEGATE_GETTER(dataOperandHasImpliedAttr(i, Kind));
}
/// @brief Extract the alignment for a call or parameter (0=unknown).
AttributeSet getAttributes() const { return AttributeSets; }
/// @brief Set the attribute list for this Function.
- void setAttributes(AttributeSet attrs) { AttributeSets = attrs; }
+ void setAttributes(AttributeSet Attrs) { AttributeSets = Attrs; }
/// @brief Add function attributes to this function.
void addFnAttr(Attribute::AttrKind N) {
}
/// @brief Remove function attributes from this function.
- void removeFnAttr(Attribute::AttrKind N) {
+ void removeFnAttr(Attribute::AttrKind Kind) {
setAttributes(AttributeSets.removeAttribute(
- getContext(), AttributeSet::FunctionIndex, N));
+ getContext(), AttributeSet::FunctionIndex, Kind));
}
/// @brief Add function attributes to this function.
void clearGC();
/// @brief adds the attribute to the list of attributes.
- void addAttribute(unsigned i, Attribute::AttrKind attr);
+ void addAttribute(unsigned i, Attribute::AttrKind Kind);
/// @brief adds the attribute to the list of attributes.
void addAttribute(unsigned i, Attribute Attr);
/// @brief adds the attributes to the list of attributes.
- void addAttributes(unsigned i, AttributeSet attrs);
+ void addAttributes(unsigned i, AttributeSet Attrs);
/// @brief removes the attribute from the list of attributes.
- void removeAttribute(unsigned i, Attribute::AttrKind attr);
+ void removeAttribute(unsigned i, Attribute::AttrKind Kind);
/// @brief removes the attributes from the list of attributes.
- void removeAttributes(unsigned i, AttributeSet attr);
+ void removeAttributes(unsigned i, AttributeSet Attrs);
/// @brief check if an attributes is in the list of attributes.
- bool hasAttribute(unsigned i, Attribute::AttrKind attr) const {
- return getAttributes().hasAttribute(i, attr);
+ bool hasAttribute(unsigned i, Attribute::AttrKind Kind) const {
+ return getAttributes().hasAttribute(i, Kind);
}
Attribute getAttribute(unsigned i, Attribute::AttrKind Kind) const {
void setAttributes(const AttributeSet &Attrs) { AttributeList = Attrs; }
/// addAttribute - adds the attribute to the list of attributes.
- void addAttribute(unsigned i, Attribute::AttrKind attr);
+ void addAttribute(unsigned i, Attribute::AttrKind Kind);
/// addAttribute - adds the attribute to the list of attributes.
void addAttribute(unsigned i, StringRef Kind, StringRef Value);
/// removeAttribute - removes the attribute from the list of attributes.
- void removeAttribute(unsigned i, Attribute::AttrKind attr);
+ void removeAttribute(unsigned i, Attribute::AttrKind Kind);
/// removeAttribute - removes the attribute from the list of attributes.
- void removeAttribute(unsigned i, Attribute attr);
+ void removeAttribute(unsigned i, Attribute Attr);
/// \brief adds the dereferenceable attribute to the list of attributes.
void addDereferenceableAttr(unsigned i, uint64_t Bytes);
void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes);
/// \brief Determine whether this call has the given attribute.
- bool hasFnAttr(Attribute::AttrKind A) const {
- assert(A != Attribute::NoBuiltin &&
+ bool hasFnAttr(Attribute::AttrKind Kind) const {
+ assert(Kind != Attribute::NoBuiltin &&
"Use CallInst::isNoBuiltin() to check for Attribute::NoBuiltin");
- return hasFnAttrImpl(A);
+ return hasFnAttrImpl(Kind);
}
/// \brief Determine whether this call has the given attribute.
- bool hasFnAttr(StringRef A) const {
- return hasFnAttrImpl(A);
+ bool hasFnAttr(StringRef Kind) const {
+ return hasFnAttrImpl(Kind);
}
/// \brief Determine whether the call or the callee has the given attributes.
- bool paramHasAttr(unsigned i, Attribute::AttrKind A) const;
+ bool paramHasAttr(unsigned i, Attribute::AttrKind Kind) const;
/// \brief Return true if the data operand at index \p i has the attribute \p
/// A.
/// \p i in [1, arg_size + 1) -> argument number (\p i - 1)
/// \p i in [arg_size + 1, data_operand_size + 1) -> bundle operand at index
/// (\p i - 1) in the operand list.
- bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind A) const;
+ bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const;
/// \brief Extract the alignment for a call or parameter (0=unknown).
unsigned getParamAlignment(unsigned i) const {
void setAttributes(const AttributeSet &Attrs) { AttributeList = Attrs; }
/// addAttribute - adds the attribute to the list of attributes.
- void addAttribute(unsigned i, Attribute::AttrKind attr);
+ void addAttribute(unsigned i, Attribute::AttrKind Kind);
/// removeAttribute - removes the attribute from the list of attributes.
- void removeAttribute(unsigned i, Attribute::AttrKind attr);
+ void removeAttribute(unsigned i, Attribute::AttrKind Kind);
/// removeAttribute - removes the attribute from the list of attributes.
- void removeAttribute(unsigned i, Attribute attr);
+ void removeAttribute(unsigned i, Attribute Attr);
/// \brief adds the dereferenceable attribute to the list of attributes.
void addDereferenceableAttr(unsigned i, uint64_t Bytes);
void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes);
/// \brief Determine whether this call has the given attribute.
- bool hasFnAttr(Attribute::AttrKind A) const {
- assert(A != Attribute::NoBuiltin &&
+ bool hasFnAttr(Attribute::AttrKind Kind) const {
+ assert(Kind != Attribute::NoBuiltin &&
"Use CallInst::isNoBuiltin() to check for Attribute::NoBuiltin");
- return hasFnAttrImpl(A);
+ return hasFnAttrImpl(Kind);
}
/// \brief Determine whether this call has the given attribute.
- bool hasFnAttr(StringRef A) const {
- return hasFnAttrImpl(A);
+ bool hasFnAttr(StringRef Kind) const {
+ return hasFnAttrImpl(Kind);
}
/// \brief Determine whether the call or the callee has the given attributes.
- bool paramHasAttr(unsigned i, Attribute::AttrKind A) const;
+ bool paramHasAttr(unsigned i, Attribute::AttrKind Kind) const;
/// \brief Return true if the data operand at index \p i has the attribute \p
/// A.
/// \p i in [1, arg_size + 1) -> argument number (\p i - 1)
/// \p i in [arg_size + 1, data_operand_size + 1) -> bundle operand at index
/// (\p i - 1) in the operand list.
- bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind A) const;
+ bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const;
/// \brief Extract the alignment for a call or parameter (0=unknown).
unsigned getParamAlignment(unsigned i) const {
}
AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index,
- ArrayRef<Attribute::AttrKind> Kind) {
+ ArrayRef<Attribute::AttrKind> Kinds) {
SmallVector<std::pair<unsigned, Attribute>, 8> Attrs;
- for (Attribute::AttrKind K : Kind)
+ for (Attribute::AttrKind K : Kinds)
Attrs.push_back(std::make_pair(Index, Attribute::get(C, K)));
return get(C, Attrs);
}
}
AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Index,
- Attribute::AttrKind Attr) const {
- if (hasAttribute(Index, Attr)) return *this;
- return addAttributes(C, Index, AttributeSet::get(C, Index, Attr));
-}
-
-AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Index,
- StringRef Kind) const {
- llvm::AttrBuilder B;
- B.addAttribute(Kind);
- return addAttributes(C, Index, AttributeSet::get(C, Index, B));
+ Attribute::AttrKind Kind) const {
+ if (hasAttribute(Index, Kind)) return *this;
+ return addAttributes(C, Index, AttributeSet::get(C, Index, Kind));
}
AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Index,
}
AttributeSet AttributeSet::removeAttribute(LLVMContext &C, unsigned Index,
- Attribute::AttrKind Attr) const {
- if (!hasAttribute(Index, Attr)) return *this;
- return removeAttributes(C, Index, AttributeSet::get(C, Index, Attr));
+ Attribute::AttrKind Kind) const {
+ if (!hasAttribute(Index, Kind)) return *this;
+ return removeAttributes(C, Index, AttributeSet::get(C, Index, Kind));
}
AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index,
clearMetadata();
}
-void Function::addAttribute(unsigned i, Attribute::AttrKind attr) {
+void Function::addAttribute(unsigned i, Attribute::AttrKind Kind) {
AttributeSet PAL = getAttributes();
- PAL = PAL.addAttribute(getContext(), i, attr);
+ PAL = PAL.addAttribute(getContext(), i, Kind);
setAttributes(PAL);
}
setAttributes(PAL);
}
-void Function::addAttributes(unsigned i, AttributeSet attrs) {
+void Function::addAttributes(unsigned i, AttributeSet Attrs) {
AttributeSet PAL = getAttributes();
- PAL = PAL.addAttributes(getContext(), i, attrs);
+ PAL = PAL.addAttributes(getContext(), i, Attrs);
setAttributes(PAL);
}
-void Function::removeAttribute(unsigned i, Attribute::AttrKind attr) {
+void Function::removeAttribute(unsigned i, Attribute::AttrKind Kind) {
AttributeSet PAL = getAttributes();
- PAL = PAL.removeAttribute(getContext(), i, attr);
+ PAL = PAL.removeAttribute(getContext(), i, Kind);
setAttributes(PAL);
}
-void Function::removeAttributes(unsigned i, AttributeSet attrs) {
+void Function::removeAttributes(unsigned i, AttributeSet Attrs) {
AttributeSet PAL = getAttributes();
- PAL = PAL.removeAttributes(getContext(), i, attrs);
+ PAL = PAL.removeAttributes(getContext(), i, Attrs);
setAttributes(PAL);
}
return NewCI;
}
-void CallInst::addAttribute(unsigned i, Attribute::AttrKind attr) {
+void CallInst::addAttribute(unsigned i, Attribute::AttrKind Kind) {
AttributeSet PAL = getAttributes();
- PAL = PAL.addAttribute(getContext(), i, attr);
+ PAL = PAL.addAttribute(getContext(), i, Kind);
setAttributes(PAL);
}
setAttributes(PAL);
}
-void CallInst::removeAttribute(unsigned i, Attribute::AttrKind attr) {
+void CallInst::removeAttribute(unsigned i, Attribute::AttrKind Kind) {
AttributeSet PAL = getAttributes();
- PAL = PAL.removeAttribute(getContext(), i, attr);
+ PAL = PAL.removeAttribute(getContext(), i, Kind);
setAttributes(PAL);
}
-void CallInst::removeAttribute(unsigned i, Attribute attr) {
+void CallInst::removeAttribute(unsigned i, Attribute Attr) {
AttributeSet PAL = getAttributes();
- AttrBuilder B(attr);
+ AttrBuilder B(Attr);
LLVMContext &Context = getContext();
PAL = PAL.removeAttributes(Context, i,
AttributeSet::get(Context, i, B));
setAttributes(PAL);
}
-bool CallInst::paramHasAttr(unsigned i, Attribute::AttrKind A) const {
+bool CallInst::paramHasAttr(unsigned i, Attribute::AttrKind Kind) const {
assert(i < (getNumArgOperands() + 1) && "Param index out of bounds!");
- if (AttributeList.hasAttribute(i, A))
+ if (AttributeList.hasAttribute(i, Kind))
return true;
if (const Function *F = getCalledFunction())
- return F->getAttributes().hasAttribute(i, A);
+ return F->getAttributes().hasAttribute(i, Kind);
return false;
}
bool CallInst::dataOperandHasImpliedAttr(unsigned i,
- Attribute::AttrKind A) const {
-
+ Attribute::AttrKind Kind) const {
// There are getNumOperands() - 1 data operands. The last operand is the
// callee.
assert(i < getNumOperands() && "Data operand index out of bounds!");
// containing operand bundle, if the operand is a bundle operand.
if (i < (getNumArgOperands() + 1))
- return paramHasAttr(i, A);
+ return paramHasAttr(i, Kind);
assert(hasOperandBundles() && i >= (getBundleOperandsStartIndex() + 1) &&
"Must be either a call argument or an operand bundle!");
- return bundleOperandHasAttr(i - 1, A);
+ return bundleOperandHasAttr(i - 1, Kind);
}
/// IsConstantOne - Return true only if val is constant int 1
return setSuccessor(idx, B);
}
-bool InvokeInst::paramHasAttr(unsigned i, Attribute::AttrKind A) const {
+bool InvokeInst::paramHasAttr(unsigned i, Attribute::AttrKind Kind) const {
assert(i < (getNumArgOperands() + 1) && "Param index out of bounds!");
- if (AttributeList.hasAttribute(i, A))
+ if (AttributeList.hasAttribute(i, Kind))
return true;
if (const Function *F = getCalledFunction())
- return F->getAttributes().hasAttribute(i, A);
+ return F->getAttributes().hasAttribute(i, Kind);
return false;
}
bool InvokeInst::dataOperandHasImpliedAttr(unsigned i,
- Attribute::AttrKind A) const {
+ Attribute::AttrKind Kind) const {
// There are getNumOperands() - 3 data operands. The last three operands are
// the callee and the two successor basic blocks.
assert(i < (getNumOperands() - 2) && "Data operand index out of bounds!");
// containing operand bundle, if the operand is a bundle operand.
if (i < (getNumArgOperands() + 1))
- return paramHasAttr(i, A);
+ return paramHasAttr(i, Kind);
assert(hasOperandBundles() && i >= (getBundleOperandsStartIndex() + 1) &&
"Must be either an invoke argument or an operand bundle!");
- return bundleOperandHasAttr(i - 1, A);
+ return bundleOperandHasAttr(i - 1, Kind);
}
-void InvokeInst::addAttribute(unsigned i, Attribute::AttrKind attr) {
+void InvokeInst::addAttribute(unsigned i, Attribute::AttrKind Kind) {
AttributeSet PAL = getAttributes();
- PAL = PAL.addAttribute(getContext(), i, attr);
+ PAL = PAL.addAttribute(getContext(), i, Kind);
setAttributes(PAL);
}
-void InvokeInst::removeAttribute(unsigned i, Attribute::AttrKind attr) {
+void InvokeInst::removeAttribute(unsigned i, Attribute::AttrKind Kind) {
AttributeSet PAL = getAttributes();
- PAL = PAL.removeAttribute(getContext(), i, attr);
+ PAL = PAL.removeAttribute(getContext(), i, Kind);
setAttributes(PAL);
}
-void InvokeInst::removeAttribute(unsigned i, Attribute attr) {
+void InvokeInst::removeAttribute(unsigned i, Attribute Attr) {
AttributeSet PAL = getAttributes();
- AttrBuilder B(attr);
+ AttrBuilder B(Attr);
PAL = PAL.removeAttributes(getContext(), i,
AttributeSet::get(getContext(), i, B));
setAttributes(PAL);