mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-06 23:31:48 +00:00
Use the AttributeSet when adding multiple attributes and an Attribute::AttrKind
when adding a single attribute to the function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173210 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bdd4e13118
commit
70d2ca0725
@ -171,7 +171,8 @@ public:
|
|||||||
/// addFnAttr - Add function attributes to this function.
|
/// addFnAttr - Add function attributes to this function.
|
||||||
///
|
///
|
||||||
void addFnAttr(Attribute::AttrKind N) {
|
void addFnAttr(Attribute::AttrKind N) {
|
||||||
addAttribute(AttributeSet::FunctionIndex, Attribute::get(getContext(), N));
|
setAttributes(AttributeList.addAttribute(getContext(),
|
||||||
|
AttributeSet::FunctionIndex, N));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm
|
/// hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm
|
||||||
@ -181,10 +182,13 @@ public:
|
|||||||
void setGC(const char *Str);
|
void setGC(const char *Str);
|
||||||
void clearGC();
|
void clearGC();
|
||||||
|
|
||||||
/// addAttribute - adds the attribute to the list of attributes.
|
/// @brief adds the attribute to the list of attributes.
|
||||||
void addAttribute(unsigned i, Attribute attr);
|
void addAttribute(unsigned i, Attribute::AttrKind attr);
|
||||||
|
|
||||||
/// removeAttribute - removes the attribute from the list of attributes.
|
/// @brief adds the attributes to the list of attributes.
|
||||||
|
void addAttributes(unsigned i, AttributeSet attrs);
|
||||||
|
|
||||||
|
/// @brief removes the attributes from the list of attributes.
|
||||||
void removeAttribute(unsigned i, Attribute attr);
|
void removeAttribute(unsigned i, Attribute attr);
|
||||||
|
|
||||||
/// @brief Extract the alignment for a call or parameter (0=unknown).
|
/// @brief Extract the alignment for a call or parameter (0=unknown).
|
||||||
@ -265,7 +269,7 @@ public:
|
|||||||
return AttributeList.hasAttribute(n, Attribute::NoAlias);
|
return AttributeList.hasAttribute(n, Attribute::NoAlias);
|
||||||
}
|
}
|
||||||
void setDoesNotAlias(unsigned n) {
|
void setDoesNotAlias(unsigned n) {
|
||||||
addAttribute(n, Attribute::get(getContext(), Attribute::NoAlias));
|
addAttribute(n, Attribute::NoAlias);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Determine if the parameter can be captured.
|
/// @brief Determine if the parameter can be captured.
|
||||||
@ -274,7 +278,7 @@ public:
|
|||||||
return AttributeList.hasAttribute(n, Attribute::NoCapture);
|
return AttributeList.hasAttribute(n, Attribute::NoCapture);
|
||||||
}
|
}
|
||||||
void setDoesNotCapture(unsigned n) {
|
void setDoesNotCapture(unsigned n) {
|
||||||
addAttribute(n, Attribute::get(getContext(), Attribute::NoCapture));
|
addAttribute(n, Attribute::NoCapture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// copyAttributesFrom - copy all additional attributes (those not needed to
|
/// copyAttributesFrom - copy all additional attributes (those not needed to
|
||||||
|
@ -125,7 +125,10 @@ bool Argument::hasStructRetAttr() const {
|
|||||||
|
|
||||||
/// addAttr - Add a Attribute to an argument
|
/// addAttr - Add a Attribute to an argument
|
||||||
void Argument::addAttr(Attribute attr) {
|
void Argument::addAttr(Attribute attr) {
|
||||||
getParent()->addAttribute(getArgNo() + 1, attr);
|
AttrBuilder B(attr);
|
||||||
|
getParent()->addAttributes(getArgNo() + 1,
|
||||||
|
AttributeSet::get(getParent()->getContext(),
|
||||||
|
getArgNo() + 1, B));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// removeAttr - Remove a Attribute from an argument
|
/// removeAttr - Remove a Attribute from an argument
|
||||||
@ -248,17 +251,21 @@ void Function::dropAllReferences() {
|
|||||||
BasicBlocks.begin()->eraseFromParent();
|
BasicBlocks.begin()->eraseFromParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Function::addAttribute(unsigned i, Attribute attr) {
|
void Function::addAttribute(unsigned i, Attribute::AttrKind attr) {
|
||||||
AttributeSet PAL = getAttributes();
|
AttributeSet PAL = getAttributes();
|
||||||
AttrBuilder B(attr);
|
PAL = PAL.addAttribute(getContext(), i, attr);
|
||||||
PAL = PAL.addAttributes(getContext(), i,
|
|
||||||
AttributeSet::get(getContext(), i, B));
|
|
||||||
setAttributes(PAL);
|
setAttributes(PAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Function::removeAttribute(unsigned i, Attribute attr) {
|
void Function::addAttributes(unsigned i, AttributeSet attrs) {
|
||||||
AttributeSet PAL = getAttributes();
|
AttributeSet PAL = getAttributes();
|
||||||
PAL = PAL.removeAttr(getContext(), i, attr);
|
PAL = PAL.addAttributes(getContext(), i, attrs);
|
||||||
|
setAttributes(PAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Function::removeAttribute(unsigned i, Attribute attrs) {
|
||||||
|
AttributeSet PAL = getAttributes();
|
||||||
|
PAL = PAL.removeAttr(getContext(), i, attrs);
|
||||||
setAttributes(PAL);
|
setAttributes(PAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,10 +219,8 @@ bool FunctionAttrs::AddReadAttrs(const CallGraphSCC &SCC) {
|
|||||||
Attribute::get(F->getContext(), B));
|
Attribute::get(F->getContext(), B));
|
||||||
|
|
||||||
// Add in the new attribute.
|
// Add in the new attribute.
|
||||||
B.clear();
|
|
||||||
B.addAttribute(ReadsMemory ? Attribute::ReadOnly : Attribute::ReadNone);
|
|
||||||
F->addAttribute(AttributeSet::FunctionIndex,
|
F->addAttribute(AttributeSet::FunctionIndex,
|
||||||
Attribute::get(F->getContext(), B));
|
ReadsMemory ? Attribute::ReadOnly : Attribute::ReadNone);
|
||||||
|
|
||||||
if (ReadsMemory)
|
if (ReadsMemory)
|
||||||
++NumReadOnly;
|
++NumReadOnly;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user