LLVM  15.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

AttributeMask typeIncompatible (Type *Ty, AttributeSafetyKind ASK=ASK_ALL)
 Which attributes cannot be applied to a type. More...
 
AttributeMask getUBImplyingAttributes ()
 Get param/return attributes which imply immediate undefined behavior if an invalid value is passed. More...
 
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. More...
 
void mergeAttributesForInlining (Function &Caller, const Function &Callee)
 Merge caller's and callee's attributes. More...
 
void mergeAttributesForOutlining (Function &Base, const Function &ToMerge)
 Merges the functions attributes from ToMerge into function Base. More...
 
void updateMinLegalVectorWidthAttr (Function &Fn, uint64_t Width)
 Update min-legal-vector-width if it is in Attribute and less than Width. More...
 

Enumeration Type Documentation

◆ AttributeSafetyKind

Enumerator
ASK_SAFE_TO_DROP 
ASK_UNSAFE_TO_DROP 
ASK_ALL 

Definition at line 1236 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 2040 of file Attributes.cpp.

References Callee.

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

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

References llvm::AttributeMask::addAttribute().

Referenced by llvm::Instruction::dropUndefImplyingAttrsAndUnknownMetadata().

◆ mergeAttributesForInlining()

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

Merge caller's and callee's attributes.

Definition at line 2050 of file Attributes.cpp.

References Callee.

Referenced by inlineCallIfPossible(), and llvm::AlwaysInlinerPass::run().

◆ 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 2055 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 1811 of file Attributes.cpp.

References llvm::AttributeMask::addAttribute(), ASK_SAFE_TO_DROP, ASK_UNSAFE_TO_DROP, llvm::Type::isIntegerTy(), llvm::Type::isPointerTy(), llvm::Type::isPtrOrPtrVectorTy(), and llvm::Type::isVoidTy().

Referenced by 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 2068 of file Attributes.cpp.

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

Referenced by doPromotion().