LLVM 20.0.0git
Enumerations | Functions
llvm::AttributeFuncs Namespace Reference

Enumerations

enum  AttributeSafetyKind : uint8_t { ASK_SAFE_TO_DROP = 1 , ASK_UNSAFE_TO_DROP = 2 , ASK_ALL = ASK_SAFE_TO_DROP | ASK_UNSAFE_TO_DROP }
 

Functions

bool isNoFPClassCompatibleType (Type *Ty)
 Returns true if this is a type legal for the 'nofpclass' attribute.
 
AttributeMask typeIncompatible (Type *Ty, AttributeSet AS, AttributeSafetyKind ASK=ASK_ALL)
 Which attributes cannot be applied to a type.
 
AttributeMask getUBImplyingAttributes ()
 Get param/return attributes which imply immediate undefined behavior if an invalid value is passed.
 
bool areInlineCompatible (const Function &Caller, const Function &Callee)
 
bool areOutlineCompatible (const Function &A, const Function &B)
 Checks if there are any incompatible function attributes between A and B.
 
void mergeAttributesForInlining (Function &Caller, const Function &Callee)
 Merge caller's and callee's attributes.
 
void mergeAttributesForOutlining (Function &Base, const Function &ToMerge)
 Merges the functions attributes from ToMerge into function Base.
 
void updateMinLegalVectorWidthAttr (Function &Fn, uint64_t Width)
 Update min-legal-vector-width if it is in Attribute and less than Width.
 

Enumeration Type Documentation

◆ AttributeSafetyKind

Enumerator
ASK_SAFE_TO_DROP 
ASK_UNSAFE_TO_DROP 
ASK_ALL 

Definition at line 1288 of file Attributes.h.

Function Documentation

◆ areInlineCompatible()

bool llvm::AttributeFuncs::areInlineCompatible ( const Function Caller,
const Function Callee 
)
Returns
Return true if the two functions have compatible target-independent attributes for inlining purposes.

Definition at line 2613 of file Attributes.cpp.

Referenced by functionsHaveCompatibleAttributes().

◆ areOutlineCompatible()

bool llvm::AttributeFuncs::areOutlineCompatible ( const Function A,
const Function B 
)

Checks if there are any incompatible function attributes between A and B.

Parameters
[in]A- The first function to be compared with.
[in]B- The second function to be compared with.
Returns
true if the functions have compatible attributes.

Definition at line 2618 of file Attributes.cpp.

References A, and B.

◆ getUBImplyingAttributes()

AttributeMask llvm::AttributeFuncs::getUBImplyingAttributes ( )

Get param/return attributes which imply immediate undefined behavior if an invalid value is passed.

For example, this includes noundef (where undef implies UB), but not nonnull (where null implies poison). It also does not include attributes like nocapture, which constrain the function implementation rather than the passed value.

Definition at line 2386 of file Attributes.cpp.

References llvm::AttributeMask::addAttribute().

Referenced by runIPSCCP().

◆ isNoFPClassCompatibleType()

bool llvm::AttributeFuncs::isNoFPClassCompatibleType ( Type Ty)

Returns true if this is a type legal for the 'nofpclass' attribute.

This follows the same type rules as FPMathOperator.

Definition at line 2313 of file Attributes.cpp.

References llvm::FPMathOperator::isSupportedFloatingPointType().

Referenced by llvm::Attributor::identifyDefaultAbstractAttributes(), typeIncompatible(), and llvm::InstCombinerImpl::visitReturnInst().

◆ mergeAttributesForInlining()

void llvm::AttributeFuncs::mergeAttributesForInlining ( Function Caller,
const Function Callee 
)

Merge caller's and callee's attributes.

Definition at line 2623 of file Attributes.cpp.

Referenced by llvm::InlineFunction().

◆ mergeAttributesForOutlining()

void llvm::AttributeFuncs::mergeAttributesForOutlining ( Function Base,
const Function ToMerge 
)

Merges the functions attributes from ToMerge into function Base.

Parameters
[in,out]Base- The function being merged into.
[in]ToMerge- The function to merge attributes from.

Definition at line 2628 of file Attributes.cpp.

References llvm::sampleprof::Base.

◆ typeIncompatible()

AttributeMask llvm::AttributeFuncs::typeIncompatible ( Type Ty,
AttributeSet  AS,
AttributeSafetyKind  ASK = ASK_ALL 
)

Which attributes cannot be applied to a type.

The argument AS is used as a hint for the attributes whose compatibility is being checked against Ty. This does not mean the return will be a subset of AS, just that attributes that have specific dynamic type compatibilities (i.e range) will be checked against what is contained in AS. The argument ASK indicates, if only attributes that are known to be safely droppable are contained in the mask; only attributes that might be unsafe to drop (e.g., ABI-related attributes) are in the mask; or both.

Definition at line 2318 of file Attributes.cpp.

References llvm::AttributeMask::addAttribute(), ASK_SAFE_TO_DROP, ASK_UNSAFE_TO_DROP, llvm::AttributeSet::getAttribute(), llvm::ConstantRange::getBitWidth(), llvm::Attribute::getRange(), llvm::Type::getScalarSizeInBits(), llvm::Type::isIntegerTy(), llvm::Type::isIntOrIntVectorTy(), isNoFPClassCompatibleType(), llvm::Type::isPointerTy(), llvm::Type::isPtrOrPtrVectorTy(), llvm::Attribute::isValid(), and llvm::Type::isVoidTy().

Referenced by llvm::CloneAndPruneIntoFromInst(), llvm::AMDGPULibCalls::fold(), llvm::InlineFunction(), mergeAttributesAndFlags(), llvm::promoteCall(), and llvm::UpgradeFunctionAttributes().

◆ updateMinLegalVectorWidthAttr()

void llvm::AttributeFuncs::updateMinLegalVectorWidthAttr ( Function Fn,
uint64_t  Width 
)

Update min-legal-vector-width if it is in Attribute and less than Width.

Definition at line 2641 of file Attributes.cpp.

References llvm::Function::addFnAttr(), llvm::StringRef::getAsInteger(), llvm::Function::getFnAttribute(), llvm::Attribute::getValueAsString(), and llvm::Attribute::isValid().

Referenced by doPromotion().