LLVM 20.0.0git
|
This namespace contains an enum with a value for every intrinsic/builtin function known by LLVM. More...
Classes | |
struct | IITDescriptor |
This is a type descriptor which explains the type requirements of an intrinsic. More... | |
Typedefs | |
using | ID = unsigned |
Enumerations | |
enum | IndependentIntrinsics : unsigned { not_intrinsic = 0 } |
enum | MatchIntrinsicTypesResult { MatchIntrinsicTypes_Match = 0 , MatchIntrinsicTypes_NoMatchRet = 1 , MatchIntrinsicTypes_NoMatchArg = 2 } |
Functions | |
StringRef | getName (ID id) |
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx". | |
StringRef | getBaseName (ID id) |
Return the LLVM name for an intrinsic, without encoded types for overloading, such as "llvm.ssa.copy". | |
std::string | getName (ID Id, ArrayRef< Type * > Tys, Module *M, FunctionType *FT=nullptr) |
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx" or "llvm.ssa.copy.p0s_s.1". | |
std::string | getNameNoUnnamedTypes (ID Id, ArrayRef< Type * > Tys) |
Return the LLVM name for an intrinsic. | |
FunctionType * | getType (LLVMContext &Context, ID id, ArrayRef< Type * > Tys=std::nullopt) |
Return the function type for an intrinsic. | |
bool | isOverloaded (ID id) |
Returns true if the intrinsic can be overloaded. | |
AttributeList | getAttributes (LLVMContext &C, ID id) |
Return the attributes for an intrinsic. | |
Function * | getDeclaration (Module *M, ID id, ArrayRef< Type * > Tys=std::nullopt) |
Create or insert an LLVM Function declaration for an intrinsic, and return it. | |
int | lookupLLVMIntrinsicByName (ArrayRef< const char * > NameTable, StringRef Name) |
Looks up Name in NameTable via binary search. | |
ID | getIntrinsicForClangBuiltin (StringRef TargetPrefix, StringRef BuiltinName) |
Map a Clang builtin name to an intrinsic ID. | |
ID | getIntrinsicForMSBuiltin (StringRef TargetPrefix, StringRef BuiltinName) |
Map a MS builtin name to an intrinsic ID. | |
bool | isConstrainedFPIntrinsic (ID QID) |
Returns true if the intrinsic ID is for one of the "Constrained
Floating-Point Intrinsics". | |
bool | hasConstrainedFPRoundingModeOperand (ID QID) |
Returns true if the intrinsic ID is for one of the "Constrained
Floating-Point Intrinsics" that take rounding mode metadata. | |
void | getIntrinsicInfoTableEntries (ID id, SmallVectorImpl< IITDescriptor > &T) |
Return the IIT table descriptor for the specified intrinsic into an array of IITDescriptors. | |
MatchIntrinsicTypesResult | matchIntrinsicSignature (FunctionType *FTy, ArrayRef< IITDescriptor > &Infos, SmallVectorImpl< Type * > &ArgTys) |
Match the specified function type with the type constraints specified by the .td file. | |
bool | matchIntrinsicVarArg (bool isVarArg, ArrayRef< IITDescriptor > &Infos) |
Verify if the intrinsic has variable arguments. | |
bool | getIntrinsicSignature (Intrinsic::ID, FunctionType *FT, SmallVectorImpl< Type * > &ArgTys) |
Gets the type arguments of an intrinsic call by matching type contraints specified by the .td file. | |
bool | getIntrinsicSignature (Function *F, SmallVectorImpl< Type * > &ArgTys) |
Same as previous, but accepts a Function instead of ID and FunctionType. | |
std::optional< Function * > | remangleIntrinsicFunction (Function *F) |
Variables | |
static const int | NoAliasScopeDeclScopeArg = 0 |
This namespace contains an enum with a value for every intrinsic/builtin function known by LLVM.
The enum values are returned by Function::getIntrinsicID().
typedef unsigned llvm::Intrinsic::ID |
Definition at line 28 of file GenericSSAContext.h.
Enumerator | |
---|---|
not_intrinsic |
Definition at line 43 of file Intrinsics.h.
Enumerator | |
---|---|
MatchIntrinsicTypes_Match | |
MatchIntrinsicTypes_NoMatchRet | |
MatchIntrinsicTypes_NoMatchArg |
Definition at line 216 of file Intrinsics.h.
AttributeList llvm::Intrinsic::getAttributes | ( | LLVMContext & | C, |
ID | id | ||
) |
Return the attributes for an intrinsic.
Referenced by llvm::CSEMIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildIntrinsic(), llvm::SITargetLowering::computeKnownAlignForTargetInstr(), llvm::SITargetLowering::getTgtMemIntrinsic(), maySpeculateLanes(), stripNonValidAttributesFromPrototype(), and llvm::UpgradeIntrinsicFunction().
Return the LLVM name for an intrinsic, without encoded types for overloading, such as "llvm.ssa.copy".
Definition at line 1091 of file Function.cpp.
References assert(), and IntrinsicNameTable.
Referenced by getIntrinsicNameImpl(), getName(), llvm::SDNode::getOperationName(), and llvm::MachineOperand::print().
Function * llvm::Intrinsic::getDeclaration | ( | Module * | M, |
ID | id, | ||
ArrayRef< Type * > | Tys = std::nullopt |
||
) |
Create or insert an LLVM Function declaration for an intrinsic, and return it.
The Tys parameter is for intrinsics with overloaded types (e.g., those using iAny, fAny, vAny, or iPTRAny). For a declaration of an overloaded intrinsic, Tys must provide exactly one type for each overloaded type in the intrinsic.
Definition at line 1539 of file Function.cpp.
References llvm::ArrayRef< T >::empty(), getName(), and getType().
Referenced by addAssumeNonNull(), addBoundsChecking(), callIntrinsic(), convertToParamAS(), convertToRelLookupTable(), llvm::IRBuilderBase::CreateAssumption(), llvm::IRBuilderBase::CreateBinaryIntrinsic(), llvm::MatrixBuilder::CreateColumnMajorLoad(), llvm::MatrixBuilder::CreateColumnMajorStore(), createCoroSave(), llvm::DbgLabelRecord::createDebugIntrinsic(), llvm::DbgVariableRecord::createDebugIntrinsic(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemMove(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemSet(), llvm::IRBuilderBase::CreateFAddReduce(), createFFSIntrinsic(), llvm::IRBuilderBase::CreateFMulReduce(), llvm::IRBuilderBase::CreateGCGetPointerBase(), llvm::IRBuilderBase::CreateGCGetPointerOffset(), llvm::IRBuilderBase::CreateGCRelocate(), CreateGCRelocates(), llvm::IRBuilderBase::CreateGCResult(), CreateGCStatepointCallCommon(), CreateGCStatepointInvokeCommon(), llvm::IRBuilderBase::CreateIntrinsic(), llvm::IRBuilderBase::CreateInvariantStart(), llvm::IRBuilderBase::createIsFPClass(), llvm::IRBuilderBase::CreateLaunderInvariantGroup(), llvm::IRBuilderBase::CreateLifetimeEnd(), llvm::IRBuilderBase::CreateLifetimeStart(), llvm::MatrixBuilder::CreateMatrixMultiply(), llvm::MatrixBuilder::CreateMatrixTranspose(), llvm::IRBuilderBase::CreateMemSet(), llvm::IRBuilderBase::CreateMemSetInline(), llvm::IRBuilderBase::CreateMemTransferInst(), llvm::IRBuilderBase::CreateNoAliasScopeDeclaration(), createPopcntIntrinsic(), llvm::IRBuilderBase::CreatePreserveArrayAccessIndex(), llvm::IRBuilderBase::CreatePreserveStructAccessIndex(), llvm::IRBuilderBase::CreatePreserveUnionAccessIndex(), CreatePrologue(), llvm::IRBuilderBase::CreateStripInvariantGroup(), createTblForTrunc(), llvm::IRBuilderBase::CreateUnaryIntrinsic(), llvm::IRBuilderBase::CreateVectorReverse(), llvm::IRBuilderBase::CreateVectorSplice(), llvm::IRBuilderBase::CreateVScale(), llvm::AArch64TargetLowering::emitAtomicCmpXchgNoStoreLLBalance(), llvm::ARMTargetLowering::emitAtomicCmpXchgNoStoreLLBalance(), llvm::AArch64TargetLowering::emitLoadLinked(), llvm::ARMTargetLowering::emitLoadLinked(), llvm::HexagonTargetLowering::emitLoadLinked(), llvm::LoongArchTargetLowering::emitMaskedAtomicCmpXchgIntrinsic(), llvm::PPCTargetLowering::emitMaskedAtomicCmpXchgIntrinsic(), llvm::RISCVTargetLowering::emitMaskedAtomicCmpXchgIntrinsic(), llvm::LoongArchTargetLowering::emitMaskedAtomicRMWIntrinsic(), llvm::PPCTargetLowering::emitMaskedAtomicRMWIntrinsic(), llvm::RISCVTargetLowering::emitMaskedAtomicRMWIntrinsic(), llvm::AArch64TargetLowering::emitStoreConditional(), llvm::ARMTargetLowering::emitStoreConditional(), llvm::HexagonTargetLowering::emitStoreConditional(), emitTPIDR2Save(), llvm::PPCTargetLowering::emitTrailingFence(), llvm::InstCombinerImpl::EvaluateInDifferentType(), llvm::VPWidenCallRecipe::execute(), expandIToFP(), explicifyGuards(), factorizeMinMaxTree(), FlattenLoopPair(), llvm::AMDGPULibCalls::fold(), foldBitwiseLogicWithIntrinsics(), foldCtpop(), foldCttzCtlz(), foldGuardedFunnelShift(), llvm::InstCombinerImpl::foldMultiplicationOverflowCheck(), foldShuffleOfUnaryOps(), foldSqrt(), foldSubOfMinMax(), foldToUnsignedSaturatedAdd(), llvm::InstCombinerImpl::foldVectorBinop(), foldVectorCmp(), llvm::SCEVExpander::generateOverflowCheck(), generateUnsignedDivisionCode(), llvm::memtag::getAndroidSlotPtr(), llvm::VPIntrinsic::getDeclarationForParams(), getDeclareIntrin(), llvm::memtag::getFP(), getStackGuard(), getStructuredLoadFunction(), getStructuredStoreFunction(), llvm::InlineFunction(), inlineRetainOrClaimRVCalls(), insertCall(), llvm::DIBuilder::insertDbgAssign(), insertLifetimeMarkersSurroundingCall(), llvm::BPFCoreSharedInfo::insertPassThrough(), llvm::GCNTTIImpl::instCombineIntrinsic(), instCombineSVEAllActive(), llvm::SampleProfileProber::instrumentOneFunc(), LLVMGetIntrinsicDeclaration(), llvm::RISCVTargetLowering::lowerDeinterleaveIntrinsicToLoad(), lowerExpectAssume(), lowerGuardIntrinsic(), llvm::ARMTargetLowering::lowerInterleavedLoad(), llvm::RISCVTargetLowering::lowerInterleavedLoad(), llvm::ARMTargetLowering::lowerInterleavedStore(), llvm::RISCVTargetLowering::lowerInterleavedStore(), llvm::RISCVTargetLowering::lowerInterleaveIntrinsicToStore(), llvm::IntrinsicLowering::LowerToByteSwap(), llvm::ARMTargetLowering::makeDMB(), makeIntrinsicCall(), llvm::coro::LowererBase::makeSubFnCall(), matchFunnelShift(), matchOrConcat(), modifyIntrinsicCall(), optimizeDoubleFP(), optimizeSection(), processUGT_ADDCST_ADD(), processUMulZExtIdiom(), llvm::memtag::readRegister(), reassociateMinMaxWithConstantInOperand(), llvm::recognizeBSwapOrBitReverseIdiom(), remangleIntrinsicFunction(), llvm::Module::removeDebugIntrinsicDeclarations(), llvm::GCNTTIImpl::rewriteIntrinsicWithAddressSpace(), llvm::KCFIPass::run(), runImpl(), simplifyAMDGCNMemoryIntrinsicDemanded(), llvm::InstCombinerImpl::SimplifyDemandedUseBits(), simplifyNvvmIntrinsic(), simplifyX86extrq(), simplifyX86insertq(), toSpvOverloadedIntrinsic(), tryToFPToSat(), tryToRecognizePopCount(), llvm::updatePublicTypeTestCalls(), upgradeAbs(), llvm::UpgradeARCRuntime(), upgradeARMIntrinsicCall(), upgradeArmOrAarch64IntrinsicFunction(), upgradeAVX512MaskToSelect(), llvm::UpgradeIntrinsicCall(), upgradeIntrinsicFunction1(), upgradePTESTIntrinsic(), upgradeX86BF16DPIntrinsic(), upgradeX86BF16Intrinsic(), upgradeX86BinaryIntrinsics(), upgradeX86ConcatShift(), upgradeX86IntrinsicCall(), upgradeX86IntrinsicFunction(), upgradeX86IntrinsicsWith8BitMask(), upgradeX86MaskedFPCompare(), upgradeX86MaskedShift(), upgradeX86Rotate(), upgradeX86VPERMT2Intrinsics(), UseTlsOffset(), useTpOffset(), llvm::InstCombinerImpl::visitAllocSite(), llvm::InstCombinerImpl::visitBitCast(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitFPTrunc(), and llvm::InstCombinerImpl::visitXor().
Map a Clang builtin name to an intrinsic ID.
Map a MS builtin name to an intrinsic ID.
void llvm::Intrinsic::getIntrinsicInfoTableEntries | ( | ID | id, |
SmallVectorImpl< IITDescriptor > & | T | ||
) |
Return the IIT table descriptor for the specified intrinsic into an array of IITDescriptors.
Definition at line 1382 of file Function.cpp.
References DecodeIITType(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::ArrayRef< T >::size().
Referenced by llvm::IRBuilderBase::CreateIntrinsic(), getIntrinsicSignature(), and getType().
bool llvm::Intrinsic::getIntrinsicSignature | ( | Function * | F, |
SmallVectorImpl< Type * > & | ArgTys | ||
) |
Same as previous, but accepts a Function instead of ID and FunctionType.
Definition at line 1857 of file Function.cpp.
References F, and getIntrinsicSignature().
bool llvm::Intrinsic::getIntrinsicSignature | ( | Intrinsic::ID | ID, |
FunctionType * | FT, | ||
SmallVectorImpl< Type * > & | ArgTys | ||
) |
Gets the type arguments of an intrinsic call by matching type contraints specified by the .td file.
The overloaded types are pushed into the AgTys vector.
Returns false if the given ID and function type combination is not a valid intrinsic call.
Definition at line 1839 of file Function.cpp.
References getIntrinsicInfoTableEntries(), llvm::FunctionType::isVarArg(), matchIntrinsicSignature(), MatchIntrinsicTypes_Match, and matchIntrinsicVarArg().
Referenced by getIntrinsicSignature(), modifyIntrinsicCall(), optimizeSection(), remangleIntrinsicFunction(), and simplifyAMDGCNMemoryIntrinsicDemanded().
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
Note, this version is for intrinsics with no overloads. Use the other version of getName if overloads are required.
Definition at line 1096 of file Function.cpp.
References assert(), getBaseName(), and isOverloaded().
Referenced by llvm::ScalarEvolution::LoopGuards::collect(), collectUnswitchCandidates(), computeVirtualCallSiteTypeInfoMap(), containsProfilingIntrinsics(), explicifyGuards(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), LLVMIntrinsicCopyOverloadedName2(), LLVMIntrinsicGetName(), lowerGuardIntrinsic(), lowerWidenableCondition(), remangleIntrinsicFunction(), replaceWithCallToVeclib(), llvm::GuardWideningPass::run(), llvm::JumpThreadingPass::runImpl(), llvm::ScalarEvolution::ScalarEvolution(), llvm::IRSimilarity::IRInstructionData::setCalleeName(), splitGlobals(), llvm::updatePublicTypeTestCalls(), and upgradeIntrinsicFunction1().
std::string llvm::Intrinsic::getName | ( | ID | Id, |
ArrayRef< Type * > | Tys, | ||
Module * | M, | ||
FunctionType * | FT = nullptr |
||
) |
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx" or "llvm.ssa.copy.p0s_s.1".
Note, this version of getName supports overloads. This is less efficient than the StringRef version of this function. If no overloads are required, it is safe to use this version, but better to use the StringRef version. If one of the types is based on an unnamed type, a function type will be computed. Providing FT will avoid this computation.
Definition at line 1130 of file Function.cpp.
References assert(), and getIntrinsicNameImpl().
Return the LLVM name for an intrinsic.
This is a special version only to be used by LLVMIntrinsicCopyOverloadedName. It only supports overloads based on named types.
Definition at line 1136 of file Function.cpp.
References getIntrinsicNameImpl().
Referenced by LLVMIntrinsicCopyOverloadedName().
FunctionType * llvm::Intrinsic::getType | ( | LLVMContext & | Context, |
ID | id, | ||
ArrayRef< Type * > | Tys = std::nullopt |
||
) |
Return the function type for an intrinsic.
Definition at line 1507 of file Function.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::back(), DecodeFixedType(), llvm::ArrayRef< T >::empty(), llvm::SmallVectorBase< Size_T >::empty(), llvm::FunctionType::get(), getIntrinsicInfoTableEntries(), llvm::SmallVectorTemplateBase< T, bool >::pop_back(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by getIntrinsicNameImpl(), and LLVMIntrinsicGetType().
bool llvm::Intrinsic::hasConstrainedFPRoundingModeOperand | ( | Intrinsic::ID | QID | ) |
Returns true if the intrinsic ID is for one of the "Constrained Floating-Point Intrinsics" that take rounding mode metadata.
Definition at line 1571 of file Function.cpp.
Referenced by llvm::IRBuilderBase::CreateConstrainedFPCall(), llvm::IRBuilderBase::CreateConstrainedFPCast(), and llvm::ConstrainedFPIntrinsic::getNonMetadataArgCount().
Returns true if the intrinsic ID is for one of the "Constrained Floating-Point Intrinsics".
Definition at line 1559 of file Function.cpp.
Referenced by llvm::ConstrainedFPIntrinsic::classof(), and llvm::Function::isConstrainedFPIntrinsic().
Returns true if the intrinsic can be overloaded.
Definition at line 1528 of file Function.cpp.
Referenced by getIntrinsicNameImpl(), getName(), LLVMIntrinsicIsOverloaded(), llvm::Function::lookupIntrinsicID(), replaceWithCallToVeclib(), and llvm::IRSimilarity::IRInstructionData::setCalleeName().
int llvm::Intrinsic::lookupLLVMIntrinsicByName | ( | ArrayRef< const char * > | NameTable, |
StringRef | Name | ||
) |
Looks up Name in NameTable via binary search.
NameTable must be sorted and all entries must start with "llvm.". If NameTable contains an exact match for Name or a prefix of Name followed by a dot, its index in NameTable is returned. Otherwise, -1 is returned.
Definition at line 239 of file IntrinsicInst.cpp.
References assert(), llvm::ArrayRef< T >::begin(), llvm::ArrayRef< T >::end(), High, LHS, llvm::Low, Name, llvm::StringRef::npos, RHS, and llvm::StringRef::size().
Referenced by isCoroutineIntrinsicName(), and llvm::Function::lookupIntrinsicID().
Intrinsic::MatchIntrinsicTypesResult llvm::Intrinsic::matchIntrinsicSignature | ( | FunctionType * | FTy, |
ArrayRef< IITDescriptor > & | Infos, | ||
SmallVectorImpl< Type * > & | ArgTys | ||
) |
Match the specified function type with the type constraints specified by the .td file.
If the given type is an overloaded type it is pushed to the ArgTys vector.
Returns false if the given type matches with the constraints, true otherwise.
Definition at line 1794 of file Function.cpp.
References Check, llvm::FunctionType::getReturnType(), I, matchIntrinsicType(), MatchIntrinsicTypes_Match, MatchIntrinsicTypes_NoMatchArg, MatchIntrinsicTypes_NoMatchRet, llvm::FunctionType::params(), and llvm::SmallVectorBase< Size_T >::size().
Referenced by getIntrinsicSignature().
bool llvm::Intrinsic::matchIntrinsicVarArg | ( | bool | isVarArg, |
ArrayRef< IITDescriptor > & | Infos | ||
) |
Verify if the intrinsic has variable arguments.
This method is intended to be called after all the fixed arguments have been matched first.
This method returns true on error.
Definition at line 1820 of file Function.cpp.
References D, llvm::ArrayRef< T >::empty(), llvm::ArrayRef< T >::front(), llvm::ArrayRef< T >::size(), and llvm::ArrayRef< T >::slice().
Referenced by getIntrinsicSignature().
Definition at line 1863 of file Function.cpp.
References assert(), F, getDeclaration(), llvm::Function::getFunctionType(), getIntrinsicSignature(), getName(), Name, llvm::Function::setCallingConv(), and llvm::Value::setName().
|
static |
Definition at line 37 of file Intrinsics.h.
Referenced by llvm::NoAliasScopeDeclInst::getScopeList(), and llvm::NoAliasScopeDeclInst::setScopeList().