llvm/llvm/lib/IR/Attributes.cpp

//===- Attributes.cpp - Implement AttributesList --------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// \file
// This file implements the Attribute, AttributeImpl, AttrBuilder,
// AttributeListImpl, and AttributeList classes.
//
//===----------------------------------------------------------------------===//

#include "llvm/IR/Attributes.h"
#include "AttributeImpl.h"
#include "LLVMContextImpl.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/AttributeMask.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/ConstantRangeList.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ModRef.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <optional>
#include <string>
#include <tuple>
#include <utility>

usingnamespacellvm;

//===----------------------------------------------------------------------===//
// Attribute Construction Methods
//===----------------------------------------------------------------------===//

// allocsize has two integer arguments, but because they're both 32 bits, we can
// pack them into one 64-bit value, at the cost of making said value
// nonsensical.
//
// In order to do this, we need to reserve one value of the second (optional)
// allocsize argument to signify "not present."
static const unsigned AllocSizeNumElemsNotPresent =;

static uint64_t packAllocSizeArgs(unsigned ElemSizeArg,
                                  const std::optional<unsigned> &NumElemsArg) {}

static std::pair<unsigned, std::optional<unsigned>>
unpackAllocSizeArgs(uint64_t Num) {}

static uint64_t packVScaleRangeArgs(unsigned MinValue,
                                    std::optional<unsigned> MaxValue) {}

static std::pair<unsigned, std::optional<unsigned>>
unpackVScaleRangeArgs(uint64_t Value) {}

Attribute Attribute::get(LLVMContext &Context, Attribute::AttrKind Kind,
                         uint64_t Val) {}

Attribute Attribute::get(LLVMContext &Context, StringRef Kind, StringRef Val) {}

Attribute Attribute::get(LLVMContext &Context, Attribute::AttrKind Kind,
                         Type *Ty) {}

Attribute Attribute::get(LLVMContext &Context, Attribute::AttrKind Kind,
                         const ConstantRange &CR) {}

Attribute Attribute::get(LLVMContext &Context, Attribute::AttrKind Kind,
                         ArrayRef<ConstantRange> Val) {}

Attribute Attribute::getWithAlignment(LLVMContext &Context, Align A) {}

Attribute Attribute::getWithStackAlignment(LLVMContext &Context, Align A) {}

Attribute Attribute::getWithDereferenceableBytes(LLVMContext &Context,
                                                uint64_t Bytes) {}

Attribute Attribute::getWithDereferenceableOrNullBytes(LLVMContext &Context,
                                                       uint64_t Bytes) {}

Attribute Attribute::getWithByValType(LLVMContext &Context, Type *Ty) {}

Attribute Attribute::getWithStructRetType(LLVMContext &Context, Type *Ty) {}

Attribute Attribute::getWithByRefType(LLVMContext &Context, Type *Ty) {}

Attribute Attribute::getWithPreallocatedType(LLVMContext &Context, Type *Ty) {}

Attribute Attribute::getWithInAllocaType(LLVMContext &Context, Type *Ty) {}

Attribute Attribute::getWithUWTableKind(LLVMContext &Context,
                                        UWTableKind Kind) {}

Attribute Attribute::getWithMemoryEffects(LLVMContext &Context,
                                          MemoryEffects ME) {}

Attribute Attribute::getWithNoFPClass(LLVMContext &Context,
                                      FPClassTest ClassMask) {}

Attribute
Attribute::getWithAllocSizeArgs(LLVMContext &Context, unsigned ElemSizeArg,
                                const std::optional<unsigned> &NumElemsArg) {}

Attribute Attribute::getWithVScaleRangeArgs(LLVMContext &Context,
                                            unsigned MinValue,
                                            unsigned MaxValue) {}

Attribute::AttrKind Attribute::getAttrKindFromName(StringRef AttrName) {}

StringRef Attribute::getNameFromAttrKind(Attribute::AttrKind AttrKind) {}

bool Attribute::isExistingAttribute(StringRef Name) {}

//===----------------------------------------------------------------------===//
// Attribute Accessor Methods
//===----------------------------------------------------------------------===//

bool Attribute::isEnumAttribute() const {}

bool Attribute::isIntAttribute() const {}

bool Attribute::isStringAttribute() const {}

bool Attribute::isTypeAttribute() const {}

bool Attribute::isConstantRangeAttribute() const {}

bool Attribute::isConstantRangeListAttribute() const {}

Attribute::AttrKind Attribute::getKindAsEnum() const {}

uint64_t Attribute::getValueAsInt() const {}

bool Attribute::getValueAsBool() const {}

StringRef Attribute::getKindAsString() const {}

StringRef Attribute::getValueAsString() const {}

Type *Attribute::getValueAsType() const {}

const ConstantRange &Attribute::getValueAsConstantRange() const {}

ArrayRef<ConstantRange> Attribute::getValueAsConstantRangeList() const {}

bool Attribute::hasAttribute(AttrKind Kind) const {}

bool Attribute::hasAttribute(StringRef Kind) const {}

MaybeAlign Attribute::getAlignment() const {}

MaybeAlign Attribute::getStackAlignment() const {}

uint64_t Attribute::getDereferenceableBytes() const {}

uint64_t Attribute::getDereferenceableOrNullBytes() const {}

std::pair<unsigned, std::optional<unsigned>>
Attribute::getAllocSizeArgs() const {}

unsigned Attribute::getVScaleRangeMin() const {}

std::optional<unsigned> Attribute::getVScaleRangeMax() const {}

UWTableKind Attribute::getUWTableKind() const {}

AllocFnKind Attribute::getAllocKind() const {}

MemoryEffects Attribute::getMemoryEffects() const {}

FPClassTest Attribute::getNoFPClass() const {}

const ConstantRange &Attribute::getRange() const {}

ArrayRef<ConstantRange> Attribute::getInitializes() const {}

static const char *getModRefStr(ModRefInfo MR) {}

std::string Attribute::getAsString(bool InAttrGrp) const {}

bool Attribute::hasParentContext(LLVMContext &C) const {}

int Attribute::cmpKind(Attribute A) const {}

bool Attribute::operator<(Attribute A) const {}

void Attribute::Profile(FoldingSetNodeID &ID) const {}

enum AttributeProperty {};

#define GET_ATTR_PROP_TABLE
#include "llvm/IR/Attributes.inc"

static unsigned getAttributeProperties(Attribute::AttrKind Kind) {}

static bool hasAttributeProperty(Attribute::AttrKind Kind,
                                 AttributeProperty Prop) {}

bool Attribute::canUseAsFnAttr(AttrKind Kind) {}

bool Attribute::canUseAsParamAttr(AttrKind Kind) {}

bool Attribute::canUseAsRetAttr(AttrKind Kind) {}

static bool hasIntersectProperty(Attribute::AttrKind Kind,
                                 AttributeProperty Prop) {}

bool Attribute::intersectMustPreserve(AttrKind Kind) {}
bool Attribute::intersectWithAnd(AttrKind Kind) {}
bool Attribute::intersectWithMin(AttrKind Kind) {}
bool Attribute::intersectWithCustom(AttrKind Kind) {}

//===----------------------------------------------------------------------===//
// AttributeImpl Definition
//===----------------------------------------------------------------------===//

bool AttributeImpl::hasAttribute(Attribute::AttrKind A) const {}

bool AttributeImpl::hasAttribute(StringRef Kind) const {}

Attribute::AttrKind AttributeImpl::getKindAsEnum() const {}

uint64_t AttributeImpl::getValueAsInt() const {}

bool AttributeImpl::getValueAsBool() const {}

StringRef AttributeImpl::getKindAsString() const {}

StringRef AttributeImpl::getValueAsString() const {}

Type *AttributeImpl::getValueAsType() const {}

const ConstantRange &AttributeImpl::getValueAsConstantRange() const {}

ArrayRef<ConstantRange> AttributeImpl::getValueAsConstantRangeList() const {}

int AttributeImpl::cmp(const AttributeImpl &AI, bool KindOnly) const {}

bool AttributeImpl::operator<(const AttributeImpl &AI) const {}

//===----------------------------------------------------------------------===//
// AttributeSet Definition
//===----------------------------------------------------------------------===//

AttributeSet AttributeSet::get(LLVMContext &C, const AttrBuilder &B) {}

AttributeSet AttributeSet::get(LLVMContext &C, ArrayRef<Attribute> Attrs) {}

AttributeSet AttributeSet::addAttribute(LLVMContext &C,
                                        Attribute::AttrKind Kind) const {}

AttributeSet AttributeSet::addAttribute(LLVMContext &C, StringRef Kind,
                                        StringRef Value) const {}

AttributeSet AttributeSet::addAttributes(LLVMContext &C,
                                         const AttributeSet AS) const {}

AttributeSet AttributeSet::removeAttribute(LLVMContext &C,
                                             Attribute::AttrKind Kind) const {}

AttributeSet AttributeSet::removeAttribute(LLVMContext &C,
                                             StringRef Kind) const {}

AttributeSet AttributeSet::removeAttributes(LLVMContext &C,
                                            const AttributeMask &Attrs) const {}

std::optional<AttributeSet>
AttributeSet::intersectWith(LLVMContext &C, AttributeSet Other) const {}

unsigned AttributeSet::getNumAttributes() const {}

bool AttributeSet::hasAttribute(Attribute::AttrKind Kind) const {}

bool AttributeSet::hasAttribute(StringRef Kind) const {}

Attribute AttributeSet::getAttribute(Attribute::AttrKind Kind) const {}

Attribute AttributeSet::getAttribute(StringRef Kind) const {}

MaybeAlign AttributeSet::getAlignment() const {}

MaybeAlign AttributeSet::getStackAlignment() const {}

uint64_t AttributeSet::getDereferenceableBytes() const {}

uint64_t AttributeSet::getDereferenceableOrNullBytes() const {}

Type *AttributeSet::getByRefType() const {}

Type *AttributeSet::getByValType() const {}

Type *AttributeSet::getStructRetType() const {}

Type *AttributeSet::getPreallocatedType() const {}

Type *AttributeSet::getInAllocaType() const {}

Type *AttributeSet::getElementType() const {}

std::optional<std::pair<unsigned, std::optional<unsigned>>>
AttributeSet::getAllocSizeArgs() const {}

unsigned AttributeSet::getVScaleRangeMin() const {}

std::optional<unsigned> AttributeSet::getVScaleRangeMax() const {}

UWTableKind AttributeSet::getUWTableKind() const {}

AllocFnKind AttributeSet::getAllocKind() const {}

MemoryEffects AttributeSet::getMemoryEffects() const {}

FPClassTest AttributeSet::getNoFPClass() const {}

std::string AttributeSet::getAsString(bool InAttrGrp) const {}

bool AttributeSet::hasParentContext(LLVMContext &C) const {}

AttributeSet::iterator AttributeSet::begin() const {}

AttributeSet::iterator AttributeSet::end() const {}

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void AttributeSet::dump() const {
  dbgs() << "AS =\n";
    dbgs() << "  { ";
    dbgs() << getAsString(true) << " }\n";
}
#endif

//===----------------------------------------------------------------------===//
// AttributeSetNode Definition
//===----------------------------------------------------------------------===//

AttributeSetNode::AttributeSetNode(ArrayRef<Attribute> Attrs)
    :{}

AttributeSetNode *AttributeSetNode::get(LLVMContext &C,
                                        ArrayRef<Attribute> Attrs) {}

AttributeSetNode *AttributeSetNode::getSorted(LLVMContext &C,
                                              ArrayRef<Attribute> SortedAttrs) {}

AttributeSetNode *AttributeSetNode::get(LLVMContext &C, const AttrBuilder &B) {}

bool AttributeSetNode::hasAttribute(StringRef Kind) const {}

std::optional<Attribute>
AttributeSetNode::findEnumAttribute(Attribute::AttrKind Kind) const {}

Attribute AttributeSetNode::getAttribute(Attribute::AttrKind Kind) const {}

Attribute AttributeSetNode::getAttribute(StringRef Kind) const {}

MaybeAlign AttributeSetNode::getAlignment() const {}

MaybeAlign AttributeSetNode::getStackAlignment() const {}

Type *AttributeSetNode::getAttributeType(Attribute::AttrKind Kind) const {}

uint64_t AttributeSetNode::getDereferenceableBytes() const {}

uint64_t AttributeSetNode::getDereferenceableOrNullBytes() const {}

std::optional<std::pair<unsigned, std::optional<unsigned>>>
AttributeSetNode::getAllocSizeArgs() const {}

unsigned AttributeSetNode::getVScaleRangeMin() const {}

std::optional<unsigned> AttributeSetNode::getVScaleRangeMax() const {}

UWTableKind AttributeSetNode::getUWTableKind() const {}

AllocFnKind AttributeSetNode::getAllocKind() const {}

MemoryEffects AttributeSetNode::getMemoryEffects() const {}

FPClassTest AttributeSetNode::getNoFPClass() const {}

std::string AttributeSetNode::getAsString(bool InAttrGrp) const {}

//===----------------------------------------------------------------------===//
// AttributeListImpl Definition
//===----------------------------------------------------------------------===//

/// Map from AttributeList index to the internal array index. Adding one happens
/// to work, because -1 wraps around to 0.
static unsigned attrIdxToArrayIdx(unsigned Index) {}

AttributeListImpl::AttributeListImpl(ArrayRef<AttributeSet> Sets)
    :{}

void AttributeListImpl::Profile(FoldingSetNodeID &ID) const {}

void AttributeListImpl::Profile(FoldingSetNodeID &ID,
                                ArrayRef<AttributeSet> Sets) {}

bool AttributeListImpl::hasAttrSomewhere(Attribute::AttrKind Kind,
                                        unsigned *Index) const {}


#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void AttributeListImpl::dump() const {
  AttributeList(const_cast<AttributeListImpl *>(this)).dump();
}
#endif

//===----------------------------------------------------------------------===//
// AttributeList Construction and Mutation Methods
//===----------------------------------------------------------------------===//

AttributeList AttributeList::getImpl(LLVMContext &C,
                                     ArrayRef<AttributeSet> AttrSets) {}

AttributeList
AttributeList::get(LLVMContext &C,
                   ArrayRef<std::pair<unsigned, Attribute>> Attrs) {}

AttributeList
AttributeList::get(LLVMContext &C,
                   ArrayRef<std::pair<unsigned, AttributeSet>> Attrs) {}

AttributeList AttributeList::get(LLVMContext &C, AttributeSet FnAttrs,
                                 AttributeSet RetAttrs,
                                 ArrayRef<AttributeSet> ArgAttrs) {}

AttributeList AttributeList::get(LLVMContext &C, unsigned Index,
                                 AttributeSet Attrs) {}

AttributeList AttributeList::get(LLVMContext &C, unsigned Index,
                                 const AttrBuilder &B) {}

AttributeList AttributeList::get(LLVMContext &C, unsigned Index,
                                 ArrayRef<Attribute::AttrKind> Kinds) {}

AttributeList AttributeList::get(LLVMContext &C, unsigned Index,
                                 ArrayRef<Attribute::AttrKind> Kinds,
                                 ArrayRef<uint64_t> Values) {}

AttributeList AttributeList::get(LLVMContext &C, unsigned Index,
                                 ArrayRef<StringRef> Kinds) {}

AttributeList AttributeList::get(LLVMContext &C,
                                 ArrayRef<AttributeList> Attrs) {}

AttributeList
AttributeList::addAttributeAtIndex(LLVMContext &C, unsigned Index,
                                   Attribute::AttrKind Kind) const {}

AttributeList AttributeList::addAttributeAtIndex(LLVMContext &C, unsigned Index,
                                                 StringRef Kind,
                                                 StringRef Value) const {}

AttributeList AttributeList::addAttributeAtIndex(LLVMContext &C, unsigned Index,
                                                 Attribute A) const {}

AttributeList AttributeList::setAttributesAtIndex(LLVMContext &C,
                                                  unsigned Index,
                                                  AttributeSet Attrs) const {}

AttributeList AttributeList::addAttributesAtIndex(LLVMContext &C,
                                                  unsigned Index,
                                                  const AttrBuilder &B) const {}

AttributeList AttributeList::addParamAttribute(LLVMContext &C,
                                               ArrayRef<unsigned> ArgNos,
                                               Attribute A) const {}

AttributeList
AttributeList::removeAttributeAtIndex(LLVMContext &C, unsigned Index,
                                      Attribute::AttrKind Kind) const {}

AttributeList AttributeList::removeAttributeAtIndex(LLVMContext &C,
                                                    unsigned Index,
                                                    StringRef Kind) const {}

AttributeList AttributeList::removeAttributesAtIndex(
    LLVMContext &C, unsigned Index, const AttributeMask &AttrsToRemove) const {}

AttributeList
AttributeList::removeAttributesAtIndex(LLVMContext &C,
                                       unsigned WithoutIndex) const {}

AttributeList AttributeList::addDereferenceableRetAttr(LLVMContext &C,
                                                       uint64_t Bytes) const {}

AttributeList AttributeList::addDereferenceableParamAttr(LLVMContext &C,
                                                         unsigned Index,
                                                         uint64_t Bytes) const {}

AttributeList
AttributeList::addDereferenceableOrNullParamAttr(LLVMContext &C, unsigned Index,
                                                 uint64_t Bytes) const {}

AttributeList AttributeList::addRangeRetAttr(LLVMContext &C,
                                             const ConstantRange &CR) const {}

AttributeList AttributeList::addAllocSizeParamAttr(
    LLVMContext &C, unsigned Index, unsigned ElemSizeArg,
    const std::optional<unsigned> &NumElemsArg) const {}

std::optional<AttributeList>
AttributeList::intersectWith(LLVMContext &C, AttributeList Other) const {}

//===----------------------------------------------------------------------===//
// AttributeList Accessor Methods
//===----------------------------------------------------------------------===//

AttributeSet AttributeList::getParamAttrs(unsigned ArgNo) const {}

AttributeSet AttributeList::getRetAttrs() const {}

AttributeSet AttributeList::getFnAttrs() const {}

bool AttributeList::hasAttributeAtIndex(unsigned Index,
                                        Attribute::AttrKind Kind) const {}

bool AttributeList::hasAttributeAtIndex(unsigned Index, StringRef Kind) const {}

bool AttributeList::hasAttributesAtIndex(unsigned Index) const {}

bool AttributeList::hasFnAttr(Attribute::AttrKind Kind) const {}

bool AttributeList::hasFnAttr(StringRef Kind) const {}

bool AttributeList::hasAttrSomewhere(Attribute::AttrKind Attr,
                                     unsigned *Index) const {}

Attribute AttributeList::getAttributeAtIndex(unsigned Index,
                                             Attribute::AttrKind Kind) const {}

Attribute AttributeList::getAttributeAtIndex(unsigned Index,
                                             StringRef Kind) const {}

MaybeAlign AttributeList::getRetAlignment() const {}

MaybeAlign AttributeList::getParamAlignment(unsigned ArgNo) const {}

MaybeAlign AttributeList::getParamStackAlignment(unsigned ArgNo) const {}

Type *AttributeList::getParamByValType(unsigned Index) const {}

Type *AttributeList::getParamStructRetType(unsigned Index) const {}

Type *AttributeList::getParamByRefType(unsigned Index) const {}

Type *AttributeList::getParamPreallocatedType(unsigned Index) const {}

Type *AttributeList::getParamInAllocaType(unsigned Index) const {}

Type *AttributeList::getParamElementType(unsigned Index) const {}

MaybeAlign AttributeList::getFnStackAlignment() const {}

MaybeAlign AttributeList::getRetStackAlignment() const {}

uint64_t AttributeList::getRetDereferenceableBytes() const {}

uint64_t AttributeList::getParamDereferenceableBytes(unsigned Index) const {}

uint64_t AttributeList::getRetDereferenceableOrNullBytes() const {}

uint64_t
AttributeList::getParamDereferenceableOrNullBytes(unsigned Index) const {}

FPClassTest AttributeList::getRetNoFPClass() const {}

FPClassTest AttributeList::getParamNoFPClass(unsigned Index) const {}

UWTableKind AttributeList::getUWTableKind() const {}

AllocFnKind AttributeList::getAllocKind() const {}

MemoryEffects AttributeList::getMemoryEffects() const {}

std::string AttributeList::getAsString(unsigned Index, bool InAttrGrp) const {}

AttributeSet AttributeList::getAttributes(unsigned Index) const {}

bool AttributeList::hasParentContext(LLVMContext &C) const {}

AttributeList::iterator AttributeList::begin() const {}

AttributeList::iterator AttributeList::end() const {}

//===----------------------------------------------------------------------===//
// AttributeList Introspection Methods
//===----------------------------------------------------------------------===//

unsigned AttributeList::getNumAttrSets() const {}

void AttributeList::print(raw_ostream &O) const {}

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void AttributeList::dump() const { print(dbgs()); }
#endif

//===----------------------------------------------------------------------===//
// AttrBuilder Method Implementations
//===----------------------------------------------------------------------===//

AttrBuilder::AttrBuilder(LLVMContext &Ctx, AttributeSet AS) :{}

void AttrBuilder::clear() {}

/// Attribute comparator that only compares attribute keys. Enum attributes are
/// sorted before string attributes.
struct AttributeComparator {};

template <typename K>
static void addAttributeImpl(SmallVectorImpl<Attribute> &Attrs, K Kind,
                             Attribute Attr) {}

AttrBuilder &AttrBuilder::addAttribute(Attribute Attr) {}

AttrBuilder &AttrBuilder::addAttribute(Attribute::AttrKind Kind) {}

AttrBuilder &AttrBuilder::addAttribute(StringRef A, StringRef V) {}

AttrBuilder &AttrBuilder::removeAttribute(Attribute::AttrKind Val) {}

AttrBuilder &AttrBuilder::removeAttribute(StringRef A) {}

std::optional<uint64_t>
AttrBuilder::getRawIntAttr(Attribute::AttrKind Kind) const {}

AttrBuilder &AttrBuilder::addRawIntAttr(Attribute::AttrKind Kind,
                                        uint64_t Value) {}

std::optional<std::pair<unsigned, std::optional<unsigned>>>
AttrBuilder::getAllocSizeArgs() const {}

AttrBuilder &AttrBuilder::addAlignmentAttr(MaybeAlign Align) {}

AttrBuilder &AttrBuilder::addStackAlignmentAttr(MaybeAlign Align) {}

AttrBuilder &AttrBuilder::addDereferenceableAttr(uint64_t Bytes) {}

AttrBuilder &AttrBuilder::addDereferenceableOrNullAttr(uint64_t Bytes) {}

AttrBuilder &
AttrBuilder::addAllocSizeAttr(unsigned ElemSize,
                              const std::optional<unsigned> &NumElems) {}

AttrBuilder &AttrBuilder::addAllocSizeAttrFromRawRepr(uint64_t RawArgs) {}

AttrBuilder &AttrBuilder::addVScaleRangeAttr(unsigned MinValue,
                                             std::optional<unsigned> MaxValue) {}

AttrBuilder &AttrBuilder::addVScaleRangeAttrFromRawRepr(uint64_t RawArgs) {}

AttrBuilder &AttrBuilder::addUWTableAttr(UWTableKind Kind) {}

AttrBuilder &AttrBuilder::addMemoryAttr(MemoryEffects ME) {}

AttrBuilder &AttrBuilder::addNoFPClassAttr(FPClassTest Mask) {}

AttrBuilder &AttrBuilder::addAllocKindAttr(AllocFnKind Kind) {}

Type *AttrBuilder::getTypeAttr(Attribute::AttrKind Kind) const {}

AttrBuilder &AttrBuilder::addTypeAttr(Attribute::AttrKind Kind, Type *Ty) {}

AttrBuilder &AttrBuilder::addByValAttr(Type *Ty) {}

AttrBuilder &AttrBuilder::addStructRetAttr(Type *Ty) {}

AttrBuilder &AttrBuilder::addByRefAttr(Type *Ty) {}

AttrBuilder &AttrBuilder::addPreallocatedAttr(Type *Ty) {}

AttrBuilder &AttrBuilder::addInAllocaAttr(Type *Ty) {}

AttrBuilder &AttrBuilder::addConstantRangeAttr(Attribute::AttrKind Kind,
                                               const ConstantRange &CR) {}

AttrBuilder &AttrBuilder::addRangeAttr(const ConstantRange &CR) {}

AttrBuilder &
AttrBuilder::addConstantRangeListAttr(Attribute::AttrKind Kind,
                                      ArrayRef<ConstantRange> Val) {}

AttrBuilder &AttrBuilder::addInitializesAttr(const ConstantRangeList &CRL) {}

AttrBuilder &AttrBuilder::merge(const AttrBuilder &B) {}

AttrBuilder &AttrBuilder::remove(const AttributeMask &AM) {}

bool AttrBuilder::overlaps(const AttributeMask &AM) const {}

Attribute AttrBuilder::getAttribute(Attribute::AttrKind A) const {}

Attribute AttrBuilder::getAttribute(StringRef A) const {}

bool AttrBuilder::contains(Attribute::AttrKind A) const {}

bool AttrBuilder::contains(StringRef A) const {}

bool AttrBuilder::operator==(const AttrBuilder &B) const {}

//===----------------------------------------------------------------------===//
// AttributeFuncs Function Defintions
//===----------------------------------------------------------------------===//

/// Returns true if this is a type legal for the 'nofpclass' attribute. This
/// follows the same type rules as FPMathOperator.
bool AttributeFuncs::isNoFPClassCompatibleType(Type *Ty) {}

/// Which attributes cannot be applied to a type.
AttributeMask AttributeFuncs::typeIncompatible(Type *Ty,
                                               AttributeSafetyKind ASK) {}

AttributeMask AttributeFuncs::getUBImplyingAttributes() {}

/// Callees with dynamic denormal modes are compatible with any caller mode.
static bool denormModeCompatible(DenormalMode CallerMode,
                                 DenormalMode CalleeMode) {}

static bool checkDenormMode(const Function &Caller, const Function &Callee) {}

static bool checkStrictFP(const Function &Caller, const Function &Callee) {}

template<typename AttrClass>
static bool isEqual(const Function &Caller, const Function &Callee) {}

static bool isEqual(const Function &Caller, const Function &Callee,
                    const StringRef &AttrName) {}

/// Compute the logical AND of the attributes of the caller and the
/// callee.
///
/// This function sets the caller's attribute to false if the callee's attribute
/// is false.
template<typename AttrClass>
static void setAND(Function &Caller, const Function &Callee) {}

/// Compute the logical OR of the attributes of the caller and the
/// callee.
///
/// This function sets the caller's attribute to true if the callee's attribute
/// is true.
template<typename AttrClass>
static void setOR(Function &Caller, const Function &Callee) {}

/// If the inlined function had a higher stack protection level than the
/// calling function, then bump up the caller's stack protection level.
static void adjustCallerSSPLevel(Function &Caller, const Function &Callee) {}

/// If the inlined function required stack probes, then ensure that
/// the calling function has those too.
static void adjustCallerStackProbes(Function &Caller, const Function &Callee) {}

/// If the inlined function defines the size of guard region
/// on the stack, then ensure that the calling function defines a guard region
/// that is no larger.
static void
adjustCallerStackProbeSize(Function &Caller, const Function &Callee) {}

/// If the inlined function defines a min legal vector width, then ensure
/// the calling function has the same or larger min legal vector width. If the
/// caller has the attribute, but the callee doesn't, we need to remove the
/// attribute from the caller since we can't make any guarantees about the
/// caller's requirements.
/// This function is called after the inlining decision has been made so we have
/// to merge the attribute this way. Heuristics that would use
/// min-legal-vector-width to determine inline compatibility would need to be
/// handled as part of inline cost analysis.
static void
adjustMinLegalVectorWidth(Function &Caller, const Function &Callee) {}

/// If the inlined function has null_pointer_is_valid attribute,
/// set this attribute in the caller post inlining.
static void
adjustNullPointerValidAttr(Function &Caller, const Function &Callee) {}

struct EnumAttr {};

struct StrBoolAttr {};

#define GET_ATTR_NAMES
#define ATTRIBUTE_ENUM
#define ATTRIBUTE_STRBOOL
#include "llvm/IR/Attributes.inc"

#define GET_ATTR_COMPAT_FUNC
#include "llvm/IR/Attributes.inc"

bool AttributeFuncs::areInlineCompatible(const Function &Caller,
                                         const Function &Callee) {}

bool AttributeFuncs::areOutlineCompatible(const Function &A,
                                          const Function &B) {}

void AttributeFuncs::mergeAttributesForInlining(Function &Caller,
                                                const Function &Callee) {}

void AttributeFuncs::mergeAttributesForOutlining(Function &Base,
                                                const Function &ToMerge) {}

void AttributeFuncs::updateMinLegalVectorWidthAttr(Function &Fn,
                                                   uint64_t Width) {}