@@ -211,6 +211,11 @@ Attribute Attribute::getWithUWTableKind(LLVMContext &Context,
211211 return get (Context, UWTable, uint64_t (Kind));
212212}
213213
214+ Attribute Attribute::getWithMemoryEffects (LLVMContext &Context,
215+ MemoryEffects ME) {
216+ return get (Context, Memory, ME.toIntValue ());
217+ }
218+
214219Attribute
215220Attribute::getWithAllocSizeArgs (LLVMContext &Context, unsigned ElemSizeArg,
216221 const Optional<unsigned > &NumElemsArg) {
@@ -831,6 +836,10 @@ AllocFnKind AttributeSet::getAllocKind() const {
831836 return SetNode ? SetNode->getAllocKind () : AllocFnKind::Unknown;
832837}
833838
839+ MemoryEffects AttributeSet::getMemoryEffects () const {
840+ return SetNode ? SetNode->getMemoryEffects () : MemoryEffects::unknown ();
841+ }
842+
834843std::string AttributeSet::getAsString (bool InAttrGrp) const {
835844 return SetNode ? SetNode->getAsString (InAttrGrp) : " " ;
836845}
@@ -1009,6 +1018,12 @@ AllocFnKind AttributeSetNode::getAllocKind() const {
10091018 return AllocFnKind::Unknown;
10101019}
10111020
1021+ MemoryEffects AttributeSetNode::getMemoryEffects () const {
1022+ if (auto A = findEnumAttribute (Attribute::Memory))
1023+ return A->getMemoryEffects ();
1024+ return MemoryEffects::unknown ();
1025+ }
1026+
10121027std::string AttributeSetNode::getAsString (bool InAttrGrp) const {
10131028 std::string Str;
10141029 for (iterator I = begin (), E = end (); I != E; ++I) {
@@ -1561,6 +1576,10 @@ AllocFnKind AttributeList::getAllocKind() const {
15611576 return getFnAttrs ().getAllocKind ();
15621577}
15631578
1579+ MemoryEffects AttributeList::getMemoryEffects () const {
1580+ return getFnAttrs ().getMemoryEffects ();
1581+ }
1582+
15641583std::string AttributeList::getAsString (unsigned Index, bool InAttrGrp) const {
15651584 return getAttributes (Index).getAsString (InAttrGrp);
15661585}
0 commit comments