LLVM  13.0.0git
Classes | Typedefs | Enumerations | Functions | Variables
llvm::Intrinsic Namespace Reference

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

typedef unsigned ID
 

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". More...
 
std::string getName (ID Id, ArrayRef< Type * > Tys)
 Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx". More...
 
std::string getName (ID Id, ArrayRef< Type * > Tys, Module *M, FunctionType *FT)
 Return the LLVM name for an intrinsic, such as "llvm.ssa.copy.p0s_s.1". More...
 
FunctionTypegetType (LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
 Return the function type for an intrinsic. More...
 
bool isOverloaded (ID id)
 Returns true if the intrinsic can be overloaded. More...
 
bool isLeaf (ID id)
 Returns true if the intrinsic is a leaf, i.e. More...
 
AttributeList getAttributes (LLVMContext &C, ID id)
 Return the attributes for an intrinsic. More...
 
FunctiongetDeclaration (Module *M, ID id, ArrayRef< Type * > Tys=None)
 Create or insert an LLVM Function declaration for an intrinsic, and return it. More...
 
int lookupLLVMIntrinsicByName (ArrayRef< const char * > NameTable, StringRef Name)
 Looks up Name in NameTable via binary search. More...
 
ID getIntrinsicForGCCBuiltin (const char *Prefix, StringRef BuiltinName)
 Map a GCC builtin name to an intrinsic ID. More...
 
ID getIntrinsicForMSBuiltin (const char *Prefix, StringRef BuiltinName)
 Map a MS builtin name to an intrinsic ID. More...
 
void getIntrinsicInfoTableEntries (ID id, SmallVectorImpl< IITDescriptor > &T)
 Return the IIT table descriptor for the specified intrinsic into an array of IITDescriptors. More...
 
MatchIntrinsicTypesResult matchIntrinsicSignature (FunctionType *FTy, ArrayRef< IITDescriptor > &Infos, SmallVectorImpl< Type * > &ArgTys)
 Match the specified function type with the type constraints specified by the .td file. More...
 
bool matchIntrinsicVarArg (bool isVarArg, ArrayRef< IITDescriptor > &Infos)
 Verify if the intrinsic has variable arguments. More...
 
bool getIntrinsicSignature (Function *F, SmallVectorImpl< Type * > &ArgTys)
 Gets the type arguments of an intrinsic call by matching type contraints specified by the .td file. More...
 
llvm::Optional< Function * > remangleIntrinsicFunction (Function *F)
 

Variables

static const int NoAliasScopeDeclScopeArg = 0
 

Detailed Description

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 Documentation

◆ ID

typedef unsigned llvm::Intrinsic::ID

Definition at line 38 of file TargetTransformInfo.h.

Enumeration Type Documentation

◆ IndependentIntrinsics

Enumerator
not_intrinsic 

Definition at line 44 of file Intrinsics.h.

◆ MatchIntrinsicTypesResult

Enumerator
MatchIntrinsicTypes_Match 
MatchIntrinsicTypes_NoMatchRet 
MatchIntrinsicTypes_NoMatchArg 

Definition at line 214 of file Intrinsics.h.

Function Documentation

◆ getAttributes()

AttributeList llvm::Intrinsic::getAttributes ( LLVMContext C,
ID  id 
)

◆ getDeclaration()

Function * llvm::Intrinsic::getDeclaration ( Module M,
ID  id,
ArrayRef< Type * >  Tys = None 
)

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 1295 of file Function.cpp.

References llvm::ArrayRef< T >::empty(), getName(), getType(), and M.

Referenced by addAssumeNonNull(), addBoundsChecking(), callIntrinsic(), llvm::changeToUnreachable(), convertToRelLookupTable(), llvm::IRBuilderBase::CreateAssumption(), llvm::IRBuilderBase::CreateBinaryIntrinsic(), llvm::MatrixBuilder< IRBuilderTy >::CreateColumnMajorLoad(), llvm::MatrixBuilder< IRBuilderTy >::CreateColumnMajorStore(), createCoroSave(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemMove(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemSet(), llvm::IRBuilderBase::CreateFAddReduce(), createFFSIntrinsic(), llvm::IRBuilderBase::CreateFMulReduce(), llvm::IRBuilderBase::CreateGCRelocate(), CreateGCRelocates(), llvm::IRBuilderBase::CreateGCResult(), CreateGCStatepointCallCommon(), CreateGCStatepointInvokeCommon(), llvm::IRBuilderBase::CreateIntrinsic(), llvm::IRBuilderBase::CreateInvariantStart(), llvm::IRBuilderBase::CreateLaunderInvariantGroup(), llvm::IRBuilderBase::CreateLifetimeEnd(), llvm::IRBuilderBase::CreateLifetimeStart(), llvm::MatrixBuilder< IRBuilderTy >::CreateMatrixMultiply(), llvm::MatrixBuilder< IRBuilderTy >::CreateMatrixTranspose(), llvm::IRBuilderBase::CreateMemCpyInline(), llvm::IRBuilderBase::CreateMemMove(), llvm::IRBuilderBase::CreateMemSet(), llvm::IRBuilderBase::CreateMemTransferInst(), llvm::IRBuilderBase::CreateNoAliasScopeDeclaration(), createPopcntIntrinsic(), createPowWithIntegerExponent(), llvm::IRBuilderBase::CreatePreserveArrayAccessIndex(), llvm::IRBuilderBase::CreatePreserveStructAccessIndex(), llvm::IRBuilderBase::CreatePreserveUnionAccessIndex(), CreatePrologue(), llvm::IRBuilderBase::CreateStripInvariantGroup(), llvm::IRBuilderBase::CreateUnaryIntrinsic(), llvm::IRBuilderBase::CreateVectorReverse(), llvm::IRBuilderBase::CreateVScale(), llvm::ARMTargetLowering::emitAtomicCmpXchgNoStoreLLBalance(), llvm::AArch64TargetLowering::emitAtomicCmpXchgNoStoreLLBalance(), llvm::HexagonTargetLowering::emitLoadLinked(), llvm::ARMTargetLowering::emitLoadLinked(), llvm::AArch64TargetLowering::emitLoadLinked(), llvm::RISCVTargetLowering::emitMaskedAtomicCmpXchgIntrinsic(), llvm::RISCVTargetLowering::emitMaskedAtomicRMWIntrinsic(), llvm::HexagonTargetLowering::emitStoreConditional(), llvm::ARMTargetLowering::emitStoreConditional(), llvm::AArch64TargetLowering::emitStoreConditional(), llvm::PPCTargetLowering::emitTrailingFence(), explicifyGuards(), foldCtpop(), foldCttzCtlz(), foldGuardedFunnelShift(), foldToUnsignedSaturatedAdd(), llvm::InstCombinerImpl::foldUnsignedMultiplicationOverflowCheck(), generateUnsignedDivisionCode(), getDeclareIntrin(), getReductionIntrinsic(), getScalarIntrinsicDeclaration(), getSqrtCall(), getStackGuard(), llvm::InlineFunction(), inlineRetainOrClaimRVCalls(), insertCall(), insertLifetimeMarkersSurroundingCall(), llvm::BPFCoreSharedInfo::insertPassThrough(), llvm::GCNTTIImpl::instCombineIntrinsic(), llvm::SampleProfileProber::instrumentOneFunc(), instrumentOneFunc(), LLVMGetIntrinsicDeclaration(), lowerGuardIntrinsic(), llvm::AArch64TargetLowering::lowerInterleavedLoad(), llvm::ARMTargetLowering::lowerInterleavedLoad(), llvm::AArch64TargetLowering::lowerInterleavedStore(), llvm::ARMTargetLowering::lowerInterleavedStore(), lowerLocalAllocas(), llvm::IntrinsicLowering::LowerToByteSwap(), llvm::ARMTargetLowering::makeDMB(), llvm::coro::LowererBase::makeSubFnCall(), matchFunnelShift(), matchOrConcat(), optimizeDoubleFP(), optimizeWithFDivFast(), optimizeWithRcp(), processUGT_ADDCST_ADD(), processUMulZExtIdiom(), llvm::recognizeBSwapOrBitReverseIdiom(), remangleIntrinsicFunction(), RemovePreallocated(), replaceUnaryCall(), llvm::GCNTTIImpl::rewriteIntrinsicWithAddressSpace(), simplifyAMDGCNImageIntrinsic(), simplifyAMDGCNMemoryIntrinsicDemanded(), SimplifyBSwap(), simplifyNvvmIntrinsic(), tryToRecognizePopCount(), upgradeAbs(), llvm::UpgradeARCRuntime(), upgradeAVX512MaskToSelect(), UpgradeIntrinsicFunction1(), UpgradePTESTIntrinsic(), UpgradeX86BinaryIntrinsics(), upgradeX86ConcatShift(), UpgradeX86IntrinsicFunction(), UpgradeX86IntrinsicsWith8BitMask(), UpgradeX86MaskedFPCompare(), UpgradeX86MaskedShift(), upgradeX86Rotate(), UpgradeX86VPERMT2Intrinsics(), UseTlsOffset(), llvm::InstCombinerImpl::visitAllocSite(), llvm::InstCombinerImpl::visitBitCast(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitFPTrunc(), and llvm::InnerLoopVectorizer::widenCallInstruction().

◆ getIntrinsicForGCCBuiltin()

ID llvm::Intrinsic::getIntrinsicForGCCBuiltin ( const char *  Prefix,
StringRef  BuiltinName 
)

Map a GCC builtin name to an intrinsic ID.

◆ getIntrinsicForMSBuiltin()

ID llvm::Intrinsic::getIntrinsicForMSBuiltin ( const char *  Prefix,
StringRef  BuiltinName 
)

Map a MS builtin name to an intrinsic ID.

◆ getIntrinsicInfoTableEntries()

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 1117 of file Function.cpp.

References DecodeIITType(), IIT_Done, llvm::ArrayRef< T >::size(), and T.

Referenced by getIntrinsicSignature(), and getType().

◆ getIntrinsicSignature()

bool llvm::Intrinsic::getIntrinsicSignature ( Function F,
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 function is not a valid intrinsic call.

Definition at line 1586 of file Function.cpp.

References F, getIntrinsicInfoTableEntries(), matchIntrinsicSignature(), MatchIntrinsicTypes_Match, and matchIntrinsicVarArg().

Referenced by remangleIntrinsicFunction(), simplifyAMDGCNImageIntrinsic(), and simplifyAMDGCNMemoryIntrinsicDemanded().

◆ getName() [1/3]

StringRef llvm::Intrinsic::getName ( ID  id)

◆ getName() [2/3]

std::string llvm::Intrinsic::getName ( ID  Id,
ArrayRef< Type * >  Tys 
)

Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".

Note, this version of getName supports overloads, but not unnamed types. It 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.

Definition at line 835 of file Function.cpp.

References getName().

◆ getName() [3/3]

std::string llvm::Intrinsic::getName ( ID  Id,
ArrayRef< Type * >  Tys,
Module M,
FunctionType FT 
)

Return the LLVM name for an intrinsic, such as "llvm.ssa.copy.p0s_s.1".

Note, this version of getName supports overloads and unnamed types, but 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. A function type FT can be provided to avoid computing it. It is used (or computed) if one of the types is based on an unnamed type.

Definition at line 813 of file Function.cpp.

References assert(), llvm::ArrayRef< T >::empty(), getMangledTypeStr(), getType(), IntrinsicNameTable, isOverloaded(), and M.

◆ getType()

FunctionType * llvm::Intrinsic::getType ( LLVMContext Context,
ID  id,
ArrayRef< Type * >  Tys = None 
)

Return the function type for an intrinsic.

Definition at line 1251 of file Function.cpp.

References Context, DecodeFixedType(), llvm::FunctionType::get(), and getIntrinsicInfoTableEntries().

Referenced by allSameType(), llvm::MachineIRBuilder::buildBlockAddress(), llvm::MachineIRBuilder::buildBoolExt(), llvm::MachineIRBuilder::buildBrIndirect(), llvm::MachineIRBuilder::buildBrJT(), llvm::MachineIRBuilder::buildSequence(), llvm::ShuffleVectorInst::changesLength(), cloneConstantExprWithNewAddressSpace(), coerceArguments(), llvm::computeMinimumValueSizes(), llvm::slpvectorizer::BoUpSLP::computeMinimumValueSizes(), llvm::ConstantFoldGetElementPtr(), llvm::Constant::containsConstantExpression(), llvm::VPReplicateRecipe::execute(), llvm::fuzzerop::gepDescriptor(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getAddRecExpr(), llvm::Constant::getAggregateElement(), llvm::AAValueConstantRange::getAssumedConstantInt(), llvm::AAPotentialValues::getAssumedConstantInt(), getDeclaration(), llvm::CastInst::getDestTy(), getFPSequenceIfElementsMatch(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getIntrinsicInstrCost(), llvm::ARMTTIImpl::getMemoryOpCost(), llvm::ScalarEvolution::getMinMaxExpr(), llvm::ScalarEvolution::getMulExpr(), getName(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), llvm::MemTransferBase< AnyMemIntrinsic >::getSourceAddressSpace(), llvm::ConstantExpr::getWithOperands(), llvm::Constant::hasExactInverseFP(), llvm::ShuffleVectorInst::increasesLength(), llvm::IntrinsicCostAttributes::IntrinsicCostAttributes(), llvm::object::XCOFFObjectFile::is64Bit(), llvm::LandingPadInst::isCatch(), llvm::object::Elf_Sym_Impl< ELFT >::isCommon(), llvm::HexagonMCInstrInfo::isCompound(), llvm::Constant::isElementWiseEqual(), llvm::ShuffleVectorInst::isExtractSubvectorMask(), llvm::LandingPadInst::isFilter(), llvm::Constant::isFiniteNonZeroFP(), llvm::HexagonMCInstrInfo::isHVX(), llvm::Constant::isNaN(), llvm::Constant::isNegativeZeroValue(), llvm::Constant::isNormalFP(), llvm::Constant::isNotMinSignedValue(), llvm::Constant::isNotOneValue(), llvm::MachineInstr::isOperandSubregIdx(), isPointerValueDeadOnEntryToFunction(), LLVMBinaryGetType(), LLVMIntrinsicGetType(), LLVMTypeOf(), llvm::ARMTargetLowering::lowerInterleavedLoad(), llvm::fuzzerop::matchFirstType(), matchScalarInAggregate(), llvm::fuzzerop::matchScalarOfFirstType(), llvm::MachineIRBuilder::materializePtrAdd(), PerformHeapAllocSRoA(), llvm::object::Elf_Sym_Impl< ELFT >::setBinding(), llvm::PHINode::setIncomingValue(), llvm::MemTransferBase< AnyMemIntrinsic >::setSource(), llvm::object::Elf_Rel_Impl< ELFType< TargetEndianness, false >, false >::setSymbol(), llvm::object::Elf_Rel_Impl< ELFType< TargetEndianness, true >, false >::setSymbol(), llvm::MemSetBase< AnyMemIntrinsic >::setValue(), SimplifyGEPInst(), speculatePHIs(), splitGlobal(), validExtractValueIndex(), validInsertValueIndex(), validShuffleVectorIndex(), llvm::InstCombinerImpl::visitLandingPadInst(), and llvm::InstCombinerImpl::visitLShr().

◆ isLeaf()

bool llvm::Intrinsic::isLeaf ( ID  id)

Returns true if the intrinsic is a leaf, i.e.

it does not make any calls itself. Most intrinsics are leafs, the exceptions being the patchpoint and statepoint intrinsics. These call (or invoke) their "target" argument.

Definition at line 1278 of file Function.cpp.

Referenced by llvm::CallGraphNode::addCalledFunction(), and DeleteBasicBlock().

◆ isOverloaded()

bool llvm::Intrinsic::isOverloaded ( ID  id)

Returns true if the intrinsic can be overloaded.

Definition at line 1272 of file Function.cpp.

Referenced by getName(), LLVMIntrinsicIsOverloaded(), llvm::Function::lookupIntrinsicID(), and replaceWithCallToVeclib().

◆ lookupLLVMIntrinsicByName()

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 127 of file IntrinsicInst.cpp.

References assert(), llvm::ArrayRef< T >::begin(), llvm::ArrayRef< T >::end(), High, llvm::StringRef::npos, and llvm::StringRef::size().

Referenced by isCoroutineIntrinsicName(), and llvm::Function::lookupIntrinsicID().

◆ matchIntrinsicSignature()

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 1541 of file Function.cpp.

References Check(), E, llvm::FunctionType::getReturnType(), I, matchIntrinsicType(), MatchIntrinsicTypes_Match, MatchIntrinsicTypes_NoMatchArg, MatchIntrinsicTypes_NoMatchRet, and llvm::FunctionType::params().

Referenced by getIntrinsicSignature().

◆ matchIntrinsicVarArg()

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 1567 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().

◆ remangleIntrinsicFunction()

Optional< Function * > llvm::Intrinsic::remangleIntrinsicFunction ( Function F)

Definition at line 1607 of file Function.cpp.

References assert(), F, getDeclaration(), getIntrinsicSignature(), getName(), and llvm::None.

Referenced by UpgradeIntrinsicFunction1().

Variable Documentation

◆ NoAliasScopeDeclScopeArg

const int llvm::Intrinsic::NoAliasScopeDeclScopeArg = 0
static