LLVM 22.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 | |
LLVM_ABI StringRef | getName (ID id) |
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx". | |
LLVM_ABI StringRef | getBaseName (ID id) |
Return the LLVM name for an intrinsic, without encoded types for overloading, such as "llvm.ssa.copy". | |
LLVM_ABI 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". | |
LLVM_ABI std::string | getNameNoUnnamedTypes (ID Id, ArrayRef< Type * > Tys) |
Return the LLVM name for an intrinsic. | |
LLVM_ABI FunctionType * | getType (LLVMContext &Context, ID id, ArrayRef< Type * > Tys={}) |
Return the function type for an intrinsic. | |
LLVM_ABI bool | isOverloaded (ID id) |
Returns true if the intrinsic can be overloaded. | |
LLVM_ABI bool | isTargetIntrinsic (ID IID) |
isTargetIntrinsic - Returns true if IID is an intrinsic specific to a certain target. | |
LLVM_ABI ID | lookupIntrinsicID (StringRef Name) |
This does the actual lookup of an intrinsic ID which matches the given function name. | |
LLVM_ABI AttributeList | getAttributes (LLVMContext &C, ID id, FunctionType *FT) |
Return the attributes for an intrinsic. | |
LLVM_ABI AttributeSet | getFnAttributes (LLVMContext &C, ID id) |
Return the function attributes for an intrinsic. | |
LLVM_ABI Function * | getOrInsertDeclaration (Module *M, ID id, ArrayRef< Type * > Tys={}) |
Look up the Function declaration of the intrinsic id in the Module M . | |
LLVM_ABI Function * | getDeclarationIfExists (const Module *M, ID id) |
Look up the Function declaration of the intrinsic id in the Module M and return it if it exists. | |
LLVM_ABI Function * | getDeclarationIfExists (Module *M, ID id, ArrayRef< Type * > Tys, FunctionType *FT=nullptr) |
This version supports overloaded intrinsics. | |
LLVM_ABI ID | getIntrinsicForClangBuiltin (StringRef TargetPrefix, StringRef BuiltinName) |
Map a Clang builtin name to an intrinsic ID. | |
LLVM_ABI ID | getIntrinsicForMSBuiltin (StringRef TargetPrefix, StringRef BuiltinName) |
Map a MS builtin name to an intrinsic ID. | |
LLVM_ABI bool | isConstrainedFPIntrinsic (ID QID) |
Returns true if the intrinsic ID is for one of the "Constrained
Floating-Point Intrinsics". | |
LLVM_ABI bool | hasConstrainedFPRoundingModeOperand (ID QID) |
Returns true if the intrinsic ID is for one of the "Constrained
Floating-Point Intrinsics" that take rounding mode metadata. | |
LLVM_ABI void | getIntrinsicInfoTableEntries (ID id, SmallVectorImpl< IITDescriptor > &T) |
Return the IIT table descriptor for the specified intrinsic into an array of IITDescriptors. | |
LLVM_ABI MatchIntrinsicTypesResult | matchIntrinsicSignature (FunctionType *FTy, ArrayRef< IITDescriptor > &Infos, SmallVectorImpl< Type * > &ArgTys) |
Match the specified function type with the type constraints specified by the .td file. | |
LLVM_ABI bool | matchIntrinsicVarArg (bool isVarArg, ArrayRef< IITDescriptor > &Infos) |
Verify if the intrinsic has variable arguments. | |
LLVM_ABI 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. | |
LLVM_ABI bool | getIntrinsicSignature (Function *F, SmallVectorImpl< Type * > &ArgTys) |
Same as previous, but accepts a Function instead of ID and FunctionType. | |
LLVM_ABI std::optional< Function * > | remangleIntrinsicFunction (Function *F) |
LLVM_ABI Intrinsic::ID | getInterleaveIntrinsicID (unsigned Factor) |
Returns the corresponding llvm.vector.interleaveN intrinsic for factor N. | |
LLVM_ABI Intrinsic::ID | getDeinterleaveIntrinsicID (unsigned Factor) |
Returns the corresponding llvm.vector.deinterleaveN intrinsic for factor N. | |
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 45 of file Intrinsics.h.
Enumerator | |
---|---|
MatchIntrinsicTypes_Match | |
MatchIntrinsicTypes_NoMatchRet | |
MatchIntrinsicTypes_NoMatchArg |
Definition at line 238 of file Intrinsics.h.
LLVM_ABI AttributeList llvm::Intrinsic::getAttributes | ( | LLVMContext & | C, |
ID | id, | ||
FunctionType * | FT | ||
) |
Return the attributes for an intrinsic.
Referenced by llvm::SITargetLowering::computeKnownAlignForTargetInstr(), stripNonValidAttributesFromPrototype(), and llvm::UpgradeIntrinsicFunction().
Return the LLVM name for an intrinsic, without encoded types for overloading, such as "llvm.ssa.copy".
Definition at line 44 of file Intrinsics.cpp.
References assert().
Referenced by llvm::VPWidenIntrinsicRecipe::getIntrinsicName(), getIntrinsicNameImpl(), getName(), llvm::SDNode::getOperationName(), and llvm::MachineOperand::print().
Look up the Function declaration of the intrinsic id
in the Module M
and return it if it exists.
Otherwise, return nullptr. This version supports non-overloaded intrinsics.
Definition at line 762 of file Intrinsics.cpp.
References getName().
Referenced by collectUnswitchCandidates(), computeVirtualCallSiteTypeInfoMap(), containsProfilingIntrinsics(), llvm::coro::declaresIntrinsics(), explicifyGuards(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), lowerGuardIntrinsic(), lowerWidenableCondition(), llvm::objcarc::ModuleHasARC(), llvm::GuardWideningPass::run(), llvm::FatLtoCleanup::run(), llvm::JumpThreadingPass::runImpl(), llvm::ScalarEvolution::ScalarEvolution(), splitGlobals(), stripDebugDeclareImpl(), and llvm::updatePublicTypeTestCalls().
Function * llvm::Intrinsic::getDeclarationIfExists | ( | Module * | M, |
ID | id, | ||
ArrayRef< Type * > | Tys, | ||
FunctionType * | FT = nullptr |
||
) |
This version supports overloaded intrinsics.
Definition at line 766 of file Intrinsics.cpp.
References getName().
Intrinsic::ID llvm::Intrinsic::getDeinterleaveIntrinsicID | ( | unsigned | Factor | ) |
Returns the corresponding llvm.vector.deinterleaveN intrinsic for factor N.
Definition at line 1156 of file Intrinsics.cpp.
References assert(), InterleaveIntrinsic::Deinterleave, and InterleaveIntrinsics.
Referenced by llvm::VPInterleaveRecipe::execute().
AttributeSet llvm::Intrinsic::getFnAttributes | ( | LLVMContext & | C, |
ID | id | ||
) |
Return the function attributes for an intrinsic.
Definition at line 743 of file Intrinsics.cpp.
References llvm::CallingConv::C.
Referenced by llvm::MachineIRBuilder::buildIntrinsic(), llvm::SITargetLowering::getTgtMemIntrinsic(), maySpeculateLanes(), and llvm::VPWidenIntrinsicRecipe::VPWidenIntrinsicRecipe().
Intrinsic::ID llvm::Intrinsic::getInterleaveIntrinsicID | ( | unsigned | Factor | ) |
Returns the corresponding llvm.vector.interleaveN intrinsic for factor N.
Definition at line 1151 of file Intrinsics.cpp.
References assert(), InterleaveIntrinsic::Interleave, and InterleaveIntrinsics.
Referenced by llvm::IRBuilderBase::CreateVectorInterleave().
LLVM_ABI ID llvm::Intrinsic::getIntrinsicForClangBuiltin | ( | StringRef | TargetPrefix, |
StringRef | BuiltinName | ||
) |
Map a Clang builtin name to an intrinsic ID.
LLVM_ABI ID llvm::Intrinsic::getIntrinsicForMSBuiltin | ( | StringRef | TargetPrefix, |
StringRef | BuiltinName | ||
) |
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 458 of file Intrinsics.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 1098 of file Intrinsics.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 1080 of file Intrinsics.cpp.
References getIntrinsicInfoTableEntries(), llvm::FunctionType::isVarArg(), matchIntrinsicSignature(), and matchIntrinsicVarArg().
Referenced by getIntrinsicSignature(), modifyIntrinsicCall(), optimizeSection(), remangleIntrinsicFunction(), simplifyAMDGCNImageIntrinsic(), simplifyAMDGCNMemoryIntrinsicDemanded(), and llvm::UpgradeIntrinsicFunction().
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 49 of file Intrinsics.cpp.
References assert(), getBaseName(), and isOverloaded().
Referenced by LLVMIntrinsicCopyOverloadedName2(), LLVMIntrinsicGetName(), remangleIntrinsicFunction(), replaceWithCallToVeclib(), and llvm::IRSimilarity::IRInstructionData::setCalleeName().
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 181 of file Intrinsics.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 187 of file Intrinsics.cpp.
References getIntrinsicNameImpl().
Referenced by LLVMIntrinsicCopyOverloadedName().
Function * llvm::Intrinsic::getOrInsertDeclaration | ( | Module * | M, |
ID | id, | ||
ArrayRef< Type * > | Tys = {} |
||
) |
Look up the Function declaration of the intrinsic id
in the Module M
.
If it does not exist, add a declaration and return it. Otherwise, return the existing declaration.
The Tys
parameter is for intrinsics with overloaded types (e.g., those using iAny, fAny, vAny, or pAny). For a declaration of an overloaded intrinsic, Tys must provide exactly one type for each overloaded type in the intrinsic.
Definition at line 751 of file Intrinsics.cpp.
References llvm::ArrayRef< T >::empty(), getName(), and getType().
Referenced by addAssumeNonNull(), convertNvvmIntrinsicToLlvm(), convertToRelLookupTable(), llvm::ConvergenceControlInst::CreateAnchor(), llvm::IRBuilderBase::CreateAssumption(), llvm::IRBuilderBase::CreateBinaryIntrinsic(), llvm::MatrixBuilder::CreateColumnMajorLoad(), llvm::MatrixBuilder::CreateColumnMajorStore(), createCoroSave(), llvm::DbgLabelRecord::createDebugIntrinsic(), llvm::DbgVariableRecord::createDebugIntrinsic(), llvm::ConvergenceControlInst::CreateEntry(), CreateGCRelocates(), CreateGCStatepointCallCommon(), CreateGCStatepointInvokeCommon(), llvm::IRBuilderBase::CreateIntrinsic(), llvm::IRBuilderBase::CreateLaunderInvariantGroup(), llvm::ConvergenceControlInst::CreateLoop(), llvm::MatrixBuilder::CreateMatrixMultiply(), llvm::MatrixBuilder::CreateMatrixTranspose(), llvm::IRBuilderBase::CreateStripInvariantGroup(), llvm::IRBuilderBase::CreateUnaryIntrinsic(), llvm::IRBuilderBase::CreateVectorReverse(), llvm::IRBuilderBase::CreateVectorSplice(), llvm::PPCTargetLowering::emitMaskedAtomicCmpXchgIntrinsic(), llvm::LoongArchTargetLowering::emitMaskedAtomicRMWIntrinsic(), llvm::RISCVTargetLowering::emitMaskedAtomicRMWIntrinsic(), llvm::OpenMPIRBuilder::emitScanReduction(), llvm::AArch64TargetLowering::emitStoreConditional(), llvm::ARMTargetLowering::emitStoreConditional(), emitTPIDR2Save(), llvm::InstCombinerImpl::EvaluateInDifferentType(), llvm::VPWidenIntrinsicRecipe::execute(), expandIToFP(), explicifyGuards(), factorizeMinMaxTree(), llvm::AMDGPULibCalls::fold(), foldBitwiseLogicWithIntrinsics(), foldCtpop(), foldCttzCtlz(), foldShuffleOfUnaryOps(), foldSubOfMinMax(), foldToUnsignedSaturatedAdd(), llvm::InstCombinerImpl::foldVectorBinop(), foldVectorCmp(), generateUnsignedDivisionCode(), llvm::memtag::getAndroidSlotPtr(), llvm::VPIntrinsic::getOrInsertDeclarationForParams(), getStructuredLoadFunction(), getStructuredStoreFunction(), llvm::GCNTTIImpl::hoistLaneIntrinsicThroughOperand(), llvm::InlineFunctionImpl(), insertCall(), insertLifetimeMarkersSurroundingCall(), llvm::BPFCoreSharedInfo::insertPassThrough(), llvm::GCNTTIImpl::instCombineIntrinsic(), llvm::SampleProfileProber::instrumentOneFunc(), LLVMGetIntrinsicDeclaration(), llvm::RISCVTargetLowering::lowerDeinterleaveIntrinsicToLoad(), lowerExpectAssume(), lowerGuardIntrinsic(), llvm::RISCVTargetLowering::lowerInterleavedStore(), llvm::RISCVTargetLowering::lowerInterleaveIntrinsicToStore(), llvm::IntrinsicLowering::LowerToByteSwap(), llvm::lowerUnaryVectorIntrinsicAsLoop(), makeIntrinsicCall(), llvm::coro::LowererBase::makeSubFnCall(), matchFunnelShift(), processUGT_ADDCST_ADD(), reassociateMinMaxWithConstantInOperand(), llvm::recognizeBSwapOrBitReverseIdiom(), remangleIntrinsicFunction(), llvm::GCNTTIImpl::rewriteIntrinsicWithAddressSpace(), runImpl(), simplifyAMDGCNImageIntrinsic(), llvm::GCNTTIImpl::simplifyAMDGCNLaneIntrinsicDemanded(), llvm::InstCombinerImpl::SimplifyDemandedUseBits(), simplifySVEIntrinsic(), llvm::updatePublicTypeTestCalls(), llvm::UpgradeARCRuntime(), upgradeArmOrAarch64IntrinsicFunction(), upgradeIntrinsicFunction1(), upgradeNVVMIntrinsicCall(), upgradePTESTIntrinsic(), upgradeX86BF16DPIntrinsic(), upgradeX86BF16Intrinsic(), upgradeX86IntrinsicCall(), upgradeX86IntrinsicFunction(), upgradeX86IntrinsicsWith8BitMask(), upgradeX86MaskedFPCompare(), UseTlsOffset(), useTpOffset(), llvm::InstCombinerImpl::visitAllocSite(), llvm::InstCombinerImpl::visitBitCast(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitFPTrunc(), and llvm::InstCombinerImpl::visitXor().
FunctionType * llvm::Intrinsic::getType | ( | LLVMContext & | Context, |
ID | id, | ||
ArrayRef< Type * > | Tys = {} |
||
) |
Return the function type for an intrinsic.
Definition at line 596 of file Intrinsics.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::back(), Context, DecodeFixedType(), llvm::ArrayRef< T >::empty(), llvm::SmallVectorBase< Size_T >::empty(), getIntrinsicInfoTableEntries(), llvm::SmallVectorTemplateBase< T, bool >::pop_back(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by llvm::SITargetLowering::computeKnownAlignForTargetInstr(), 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 794 of file Intrinsics.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 782 of file Intrinsics.cpp.
Referenced by llvm::ConstrainedFPIntrinsic::classof().
Returns true if the intrinsic can be overloaded.
Definition at line 618 of file Intrinsics.cpp.
Referenced by llvm::coro::declaresIntrinsics(), getIntrinsicNameImpl(), getName(), LLVMIntrinsicIsOverloaded(), lookupIntrinsicID(), llvm::objcarc::ModuleHasARC(), replaceWithCallToVeclib(), and llvm::IRSimilarity::IRInstructionData::setCalleeName().
bool llvm::Intrinsic::isTargetIntrinsic | ( | Intrinsic::ID | IID | ) |
isTargetIntrinsic - Returns true if IID is an intrinsic specific to a certain target.
If it is a generic intrinsic false is returned.
Definition at line 629 of file Intrinsics.cpp.
Referenced by llvm::BasicTTIImplBase< T >::getIntrinsicInstrCost(), llvm::isTriviallyScalarizable(), llvm::isVectorIntrinsicWithOverloadTypeAtArg(), llvm::isVectorIntrinsicWithScalarOpAtArg(), and llvm::isVectorIntrinsicWithStructReturnOverloadAtField().
Intrinsic::ID llvm::Intrinsic::lookupIntrinsicID | ( | StringRef | Name | ) |
This does the actual lookup of an intrinsic ID which matches the given function name.
Definition at line 718 of file Intrinsics.cpp.
References assert(), findTargetSubtable(), Idx, isOverloaded(), lookupLLVMIntrinsicByName(), Name, and not_intrinsic.
Referenced by isOldDbgFormatIntrinsic(), and LLVMLookupIntrinsicID().
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 1036 of file Intrinsics.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 1061 of file Intrinsics.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 1104 of file Intrinsics.cpp.
References assert(), F, llvm::Function::getFunctionType(), getIntrinsicSignature(), getName(), getOrInsertDeclaration(), Name, llvm::Function::setCallingConv(), and llvm::Value::setName().
|
static |
Definition at line 39 of file Intrinsics.h.
Referenced by llvm::NoAliasScopeDeclInst::getScopeList(), and llvm::NoAliasScopeDeclInst::setScopeList().