diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/include/llvm/IR/Attributes.h | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/include/llvm/IR/Attributes.h')
-rw-r--r-- | contrib/libs/llvm12/include/llvm/IR/Attributes.h | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/contrib/libs/llvm12/include/llvm/IR/Attributes.h b/contrib/libs/llvm12/include/llvm/IR/Attributes.h index f45741edc2..75510c5195 100644 --- a/contrib/libs/llvm12/include/llvm/IR/Attributes.h +++ b/contrib/libs/llvm12/include/llvm/IR/Attributes.h @@ -115,17 +115,17 @@ public: unsigned ElemSizeArg, const Optional<unsigned> &NumElemsArg); static Attribute getWithByValType(LLVMContext &Context, Type *Ty); - static Attribute getWithStructRetType(LLVMContext &Context, Type *Ty); - static Attribute getWithByRefType(LLVMContext &Context, Type *Ty); + static Attribute getWithStructRetType(LLVMContext &Context, Type *Ty); + static Attribute getWithByRefType(LLVMContext &Context, Type *Ty); static Attribute getWithPreallocatedType(LLVMContext &Context, Type *Ty); - /// For a typed attribute, return the equivalent attribute with the type - /// changed to \p ReplacementTy. - Attribute getWithNewType(LLVMContext &Context, Type *ReplacementTy) { - assert(isTypeAttribute() && "this requires a typed attribute"); - return get(Context, getKindAsEnum(), ReplacementTy); - } - + /// For a typed attribute, return the equivalent attribute with the type + /// changed to \p ReplacementTy. + Attribute getWithNewType(LLVMContext &Context, Type *ReplacementTy) { + assert(isTypeAttribute() && "this requires a typed attribute"); + return get(Context, getKindAsEnum(), ReplacementTy); + } + static Attribute::AttrKind getAttrKindFromName(StringRef AttrName); static StringRef getNameFromAttrKind(Attribute::AttrKind AttrKind); @@ -154,9 +154,9 @@ public: /// Return true if the attribute is a type attribute. bool isTypeAttribute() const; - /// Return true if the attribute is any kind of attribute. - bool isValid() const { return pImpl; } - + /// Return true if the attribute is any kind of attribute. + bool isValid() const { return pImpl; } + /// Return true if the attribute is present. bool hasAttribute(AttrKind Val) const; @@ -322,8 +322,8 @@ public: uint64_t getDereferenceableBytes() const; uint64_t getDereferenceableOrNullBytes() const; Type *getByValType() const; - Type *getStructRetType() const; - Type *getByRefType() const; + Type *getStructRetType() const; + Type *getByRefType() const; Type *getPreallocatedType() const; std::pair<unsigned, Optional<unsigned>> getAllocSizeArgs() const; std::string getAsString(bool InAttrGrp = false) const; @@ -406,9 +406,9 @@ private: static AttributeList getImpl(LLVMContext &C, ArrayRef<AttributeSet> AttrSets); - AttributeList setAttributes(LLVMContext &C, unsigned Index, - AttributeSet Attrs) const; - + AttributeList setAttributes(LLVMContext &C, unsigned Index, + AttributeSet Attrs) const; + public: AttributeList() = default; @@ -527,17 +527,17 @@ public: return removeAttributes(C, ArgNo + FirstArgIndex); } - /// Replace the type contained by attribute \p AttrKind at index \p ArgNo wih - /// \p ReplacementTy, preserving all other attributes. - LLVM_NODISCARD AttributeList replaceAttributeType(LLVMContext &C, - unsigned ArgNo, - Attribute::AttrKind Kind, - Type *ReplacementTy) const { - Attribute Attr = getAttribute(ArgNo, Kind); - auto Attrs = removeAttribute(C, ArgNo, Kind); - return Attrs.addAttribute(C, ArgNo, Attr.getWithNewType(C, ReplacementTy)); - } - + /// Replace the type contained by attribute \p AttrKind at index \p ArgNo wih + /// \p ReplacementTy, preserving all other attributes. + LLVM_NODISCARD AttributeList replaceAttributeType(LLVMContext &C, + unsigned ArgNo, + Attribute::AttrKind Kind, + Type *ReplacementTy) const { + Attribute Attr = getAttribute(ArgNo, Kind); + auto Attrs = removeAttribute(C, ArgNo, Kind); + return Attrs.addAttribute(C, ArgNo, Attr.getWithNewType(C, ReplacementTy)); + } + /// \brief Add the dereferenceable attribute to the attribute set at the given /// index. Returns a new list because attribute lists are immutable. LLVM_NODISCARD AttributeList addDereferenceableAttr(LLVMContext &C, @@ -661,12 +661,12 @@ public: /// Return the byval type for the specified function parameter. Type *getParamByValType(unsigned ArgNo) const; - /// Return the sret type for the specified function parameter. - Type *getParamStructRetType(unsigned ArgNo) const; - - /// Return the byref type for the specified function parameter. - Type *getParamByRefType(unsigned ArgNo) const; - + /// Return the sret type for the specified function parameter. + Type *getParamStructRetType(unsigned ArgNo) const; + + /// Return the byref type for the specified function parameter. + Type *getParamByRefType(unsigned ArgNo) const; + /// Return the preallocated type for the specified function parameter. Type *getParamPreallocatedType(unsigned ArgNo) const; @@ -770,8 +770,8 @@ class AttrBuilder { uint64_t DerefOrNullBytes = 0; uint64_t AllocSizeArgs = 0; Type *ByValType = nullptr; - Type *StructRetType = nullptr; - Type *ByRefType = nullptr; + Type *StructRetType = nullptr; + Type *ByRefType = nullptr; Type *PreallocatedType = nullptr; public: @@ -787,14 +787,14 @@ public: void clear(); /// Add an attribute to the builder. - AttrBuilder &addAttribute(Attribute::AttrKind Val) { - assert((unsigned)Val < Attribute::EndAttrKinds && - "Attribute out of range!"); - assert(!Attribute::doesAttrKindHaveArgument(Val) && - "Adding integer attribute without adding a value!"); - Attrs[Val] = true; - return *this; - } + AttrBuilder &addAttribute(Attribute::AttrKind Val) { + assert((unsigned)Val < Attribute::EndAttrKinds && + "Attribute out of range!"); + assert(!Attribute::doesAttrKindHaveArgument(Val) && + "Adding integer attribute without adding a value!"); + Attrs[Val] = true; + return *this; + } /// Add the Attribute object to the builder. AttrBuilder &addAttribute(Attribute A); @@ -858,12 +858,12 @@ public: /// Retrieve the byval type. Type *getByValType() const { return ByValType; } - /// Retrieve the sret type. - Type *getStructRetType() const { return StructRetType; } - - /// Retrieve the byref type. - Type *getByRefType() const { return ByRefType; } - + /// Retrieve the sret type. + Type *getStructRetType() const { return StructRetType; } + + /// Retrieve the byref type. + Type *getByRefType() const { return ByRefType; } + /// Retrieve the preallocated type. Type *getPreallocatedType() const { return PreallocatedType; } @@ -910,12 +910,12 @@ public: /// This turns a byval type into the form used internally in Attribute. AttrBuilder &addByValAttr(Type *Ty); - /// This turns a sret type into the form used internally in Attribute. - AttrBuilder &addStructRetAttr(Type *Ty); - - /// This turns a byref type into the form used internally in Attribute. - AttrBuilder &addByRefAttr(Type *Ty); - + /// This turns a sret type into the form used internally in Attribute. + AttrBuilder &addStructRetAttr(Type *Ty); + + /// This turns a byref type into the form used internally in Attribute. + AttrBuilder &addByRefAttr(Type *Ty); + /// This turns a preallocated type into the form used internally in Attribute. AttrBuilder &addPreallocatedAttr(Type *Ty); @@ -961,24 +961,24 @@ AttrBuilder typeIncompatible(Type *Ty); /// attributes for inlining purposes. bool areInlineCompatible(const Function &Caller, const Function &Callee); - -/// Checks if there are any incompatible function attributes between -/// \p A and \p B. -/// -/// \param [in] A - The first function to be compared with. -/// \param [in] B - The second function to be compared with. -/// \returns true if the functions have compatible attributes. -bool areOutlineCompatible(const Function &A, const Function &B); - + +/// Checks if there are any incompatible function attributes between +/// \p A and \p B. +/// +/// \param [in] A - The first function to be compared with. +/// \param [in] B - The second function to be compared with. +/// \returns true if the functions have compatible attributes. +bool areOutlineCompatible(const Function &A, const Function &B); + /// Merge caller's and callee's attributes. void mergeAttributesForInlining(Function &Caller, const Function &Callee); -/// Merges the functions attributes from \p ToMerge into function \p Base. -/// -/// \param [in,out] Base - The function being merged into. -/// \param [in] ToMerge - The function to merge attributes from. -void mergeAttributesForOutlining(Function &Base, const Function &ToMerge); - +/// Merges the functions attributes from \p ToMerge into function \p Base. +/// +/// \param [in,out] Base - The function being merged into. +/// \param [in] ToMerge - The function to merge attributes from. +void mergeAttributesForOutlining(Function &Base, const Function &ToMerge); + } // end namespace AttributeFuncs } // end namespace llvm |