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, 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 1257 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 2393 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 2398 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 2166 of file Attributes.cpp.

References llvm::AttributeMask::addAttribute().

Referenced by llvm::Instruction::dropUBImplyingAttrsAndUnknownMetadata(), and 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.

This follows the same type rules as FPMathOperator.

TODO: Consider relaxing to any FP type struct fields.

Definition at line 2096 of file Attributes.cpp.

References llvm::Type::isFPOrFPVectorTy().

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 2403 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 2408 of file Attributes.cpp.

References llvm::sampleprof::Base.

◆ typeIncompatible()

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

Which attributes cannot be applied to a type.

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 2103 of file Attributes.cpp.

References llvm::AttributeMask::addAttribute(), ASK_SAFE_TO_DROP, ASK_UNSAFE_TO_DROP, llvm::Type::isIntegerTy(), llvm::Type::isIntOrIntVectorTy(), isNoFPClassCompatibleType(), llvm::Type::isPointerTy(), llvm::Type::isPtrOrPtrVectorTy(), 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 2421 of file Attributes.cpp.

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

Referenced by doPromotion().