LLVM  6.0.0svn
Classes | Enumerations | Functions
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...
 

Enumerations

enum  ID : unsigned { not_intrinsic = 0, num_intrinsics }
 

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...
 
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...
 
bool matchIntrinsicType (Type *Ty, ArrayRef< IITDescriptor > &Infos, SmallVectorImpl< Type *> &ArgTys)
 Match the specified type (which comes from an intrinsic argument or return value) 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...
 
llvm::Optional< Function * > remangleIntrinsicFunction (Function *F)
 

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

Enumeration Type Documentation

◆ ID

Enumerator
not_intrinsic 
num_intrinsics 

Definition at line 37 of file Intrinsics.h.

Function Documentation

◆ getAttributes()

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

Return the attributes for an intrinsic.

Referenced by llvm::AttributeList::addAllocSizeParamAttr(), llvm::Function::addAttribute(), llvm::Function::addAttributes(), llvm::AttributeList::addAttributes(), llvm::Function::addDereferenceableAttr(), llvm::Function::addDereferenceableOrNullAttr(), llvm::Function::addDereferenceableOrNullParamAttr(), llvm::Function::addDereferenceableParamAttr(), llvm::Function::addParamAttr(), llvm::Function::addParamAttrs(), llvm::attributesPermitTailCall(), llvm::FunctionComparator::cmpOperations(), llvm::AttributeList::dump(), llvm::Function::eraseFromParent(), llvm::AttributeList::getAllocSizeArgs(), llvm::AttributeList::getAsString(), llvm::AttributeList::getAttribute(), llvm::CallInst::getAttribute(), llvm::InvokeInst::getAttribute(), llvm::CallSiteBase<>::getAttributes(), llvm::AMDGPUIntrinsicInfo::getDeclaration(), llvm::AttributeList::getDereferenceableBytes(), llvm::AttributeList::getDereferenceableOrNullBytes(), llvm::AttributeList::getFnAttributes(), llvm::AttributeList::getParamAlignment(), llvm::CallInst::getParamAttr(), llvm::AttributeList::getParamAttributes(), llvm::AttributeList::getRetAlignment(), llvm::AttributeList::getRetAttributes(), llvm::AttributeList::getStackAlignment(), llvm::Function::hasAttribute(), llvm::AttributeList::hasAttribute(), llvm::AttributeList::hasAttributes(), llvm::Function::hasParamAttribute(), haveSameSpecialState(), LLVMGetAttributeCountAtIndex(), LLVMGetAttributesAtIndex(), readTriple(), readWideAPInt(), llvm::Function::removeAttribute(), llvm::Function::removeAttributes(), llvm::Function::removeFnAttr(), llvm::Function::removeParamAttr(), llvm::Function::removeParamAttrs(), and llvm::UpgradeIntrinsicFunction().

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

References llvm::Module::getContext(), llvm::Value::getName(), llvm::Module::getOrInsertFunction(), and llvm::Value::getType().

Referenced by addAssumeNonNull(), addBoundsChecking(), asmClobbersCTR(), callIntrinsic(), llvm::changeToUnreachable(), llvm::collectCmpOps(), CombineUAddWithOverflow(), llvm::IRBuilderBase::CreateAssumption(), llvm::IRBuilderBase::CreateBinaryIntrinsic(), createCoroSave(), createCTLZIntrinsic(), llvm::IRBuilderBase::CreateElementUnorderedAtomicMemCpy(), llvm::IRBuilderBase::CreateFAddReduce(), llvm::IRBuilderBase::CreateFMulReduce(), llvm::IRBuilderBase::CreateGCRelocate(), CreateGCRelocates(), llvm::IRBuilderBase::CreateGCResult(), CreateGCStatepointCallCommon(), CreateGCStatepointInvokeCommon(), llvm::IRBuilder< TargetFolder >::CreateInvariantGroupBarrier(), llvm::IRBuilderBase::CreateInvariantStart(), llvm::IRBuilderBase::CreateLifetimeEnd(), llvm::IRBuilderBase::CreateLifetimeStart(), llvm::IRBuilderBase::CreateMaskedStore(), llvm::IRBuilderBase::CreateMemCpy(), llvm::IRBuilderBase::CreateMemMove(), llvm::IRBuilderBase::CreateMemSet(), createPopcntIntrinsic(), CreatePrologue(), llvm::AArch64TargetLowering::emitAtomicCmpXchgNoStoreLLBalance(), llvm::ARMTargetLowering::emitAtomicCmpXchgNoStoreLLBalance(), llvm::HexagonTargetLowering::emitLoadLinked(), llvm::AArch64TargetLowering::emitLoadLinked(), llvm::ARMTargetLowering::emitLoadLinked(), llvm::HexagonTargetLowering::emitStoreConditional(), llvm::AArch64TargetLowering::emitStoreConditional(), llvm::ARMTargetLowering::emitStoreConditional(), llvm::PPCTargetLowering::emitTrailingFence(), llvm::SCEVExpander::generateOverflowCheck(), generateUnsignedDivisionCode(), getDeclareIntrin(), getPointerOperands(), getPow(), getReductionIntrinsic(), getScalarIntrinsicDeclaration(), getStackGuard(), getSuccState(), INITIALIZE_PASS(), llvm::InlineFunction(), insertCall(), insertSinCosCall(), instrumentOneFunc(), isAtomic(), isCallPromotable(), isIndirectBrTarget(), isZeroLengthArray(), lowerGuardIntrinsic(), llvm::AArch64TargetLowering::lowerInterleavedLoad(), llvm::ARMTargetLowering::lowerInterleavedLoad(), llvm::AArch64TargetLowering::lowerInterleavedStore(), llvm::ARMTargetLowering::lowerInterleavedStore(), llvm::IntrinsicLowering::LowerToByteSwap(), LowerXALUO(), llvm::ARMTargetLowering::makeDMB(), llvm::coro::LowererBase::makeSubFnCall(), MarkBlocksLiveIn(), moveUp(), optimizeUnaryDoubleFP(), processUGT_ADDCST_ADD(), processUMulZExtIdiom(), promotedOpIsNUW(), llvm::recognizeBSwapOrBitReverseIdiom(), RedzoneSizeForScale(), remangleIntrinsicFunction(), replaceAllUsesOfWithIn(), replaceUnaryCall(), llvm::LoopDataPrefetchPass::run(), llvm::WholeProgramDevirtPass::run(), llvm::StackProtector::runOnFunction(), shouldInstrumentBlock(), shouldKeepFDivF32(), shouldReorderOperands(), ShrinkDemandedConstant(), SimplifyBSwap(), SimplifyNVVMIntrinsic(), simplifyX86extrq(), simplifyX86insertq(), TypeSizeToSizeIndex(), unifyReturnBlockSet(), llvm::UpgradeIntrinsicCall(), UpgradeIntrinsicFunction1(), UpgradePTESTIntrinsic(), UpgradeX86IntrinsicFunction(), UpgradeX86IntrinsicsWith8BitMask(), UpgradeX86MaskedShift(), UseTlsOffset(), llvm::InstCombiner::visitAllocSite(), llvm::InstCombiner::visitCallInst(), llvm::InstCombiner::visitFPTrunc(), and llvm::InnerLoopVectorizer::widenInstruction().

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

References DecodeIITType(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), and llvm::ArrayRef< T >::size().

Referenced by llvm::Intrinsic::IITDescriptor::get(), getParentPad(), getType(), and remangleIntrinsicFunction().

◆ getName() [1/2]

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

◆ getName() [2/2]

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 is less efficient than the StringRef version of this function. If no overloads are requried, it is safe to use this version, but better to use the StringRef version.

Definition at line 598 of file Function.cpp.

References assert(), getMangledTypeStr(), and num_intrinsics.

◆ getType()

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

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

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

◆ isOverloaded()

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

Returns true if the intrinsic can be overloaded.

Definition at line 957 of file Function.cpp.

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

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

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

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

◆ matchIntrinsicType()

bool llvm::Intrinsic::matchIntrinsicType ( Type Ty,
ArrayRef< IITDescriptor > &  Infos,
SmallVectorImpl< Type *> &  ArgTys 
)

Match the specified type (which comes from an intrinsic argument or return value) 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 998 of file Function.cpp.

References assert(), D, llvm::pdb::Double, llvm::dyn_cast(), llvm::ArrayRef< T >::empty(), llvm::NVPTX::PTXLdStInstCode::Float, llvm::ArrayRef< T >::front(), llvm::IntegerType::get(), llvm::PointerType::getAddressSpace(), llvm::Intrinsic::IITDescriptor::getArgumentKind(), llvm::Intrinsic::IITDescriptor::getArgumentNumber(), llvm::StructType::getElementType(), llvm::SequentialType::getElementType(), llvm::PointerType::getElementType(), llvm::VectorType::getExtendedElementVectorType(), llvm::VectorType::getHalfElementsVectorType(), llvm::StructType::getNumElements(), llvm::SequentialType::getNumElements(), llvm::Intrinsic::IITDescriptor::getOverloadArgNumber(), llvm::Intrinsic::IITDescriptor::getRefArgNumber(), llvm::VectorType::getTruncatedElementVectorType(), llvm::Type::getVectorElementType(), llvm::Type::getVectorNumElements(), llvm::Integer, llvm::Intrinsic::IITDescriptor::Integer_Width, llvm::Type::isDoubleTy(), llvm::Type::isFloatTy(), llvm::Type::isFPOrFPVectorTy(), llvm::Type::isHalfTy(), llvm::Type::isIntegerTy(), llvm::Type::isIntOrIntVectorTy(), llvm::Type::isMetadataTy(), llvm::Type::isTokenTy(), llvm::Type::isVoidTy(), llvm::Type::isX86_MMXTy(), llvm::Intrinsic::IITDescriptor::Kind, llvm_unreachable, llvm::Intrinsic::IITDescriptor::Pointer_AddressSpace, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::ArrayRef< T >::slice(), llvm::ARM_MB::ST, llvm::Intrinsic::IITDescriptor::Struct_NumElements, and llvm::Intrinsic::IITDescriptor::Vector_Width.

Referenced by llvm::Intrinsic::IITDescriptor::get(), getParentPad(), and remangleIntrinsicFunction().

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

References D, llvm::ArrayRef< T >::empty(), llvm::ArrayRef< T >::front(), llvm::Intrinsic::IITDescriptor::Kind, llvm::ArrayRef< T >::size(), and llvm::ArrayRef< T >::slice().

Referenced by llvm::Intrinsic::IITDescriptor::get(), getParentPad(), and remangleIntrinsicFunction().

◆ remangleIntrinsicFunction()

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