18#include "llvm/IR/IntrinsicsAArch64.h"
19#include "llvm/IR/IntrinsicsAMDGPU.h"
20#include "llvm/IR/IntrinsicsARM.h"
21#include "llvm/IR/IntrinsicsBPF.h"
22#include "llvm/IR/IntrinsicsHexagon.h"
23#include "llvm/IR/IntrinsicsLoongArch.h"
24#include "llvm/IR/IntrinsicsMips.h"
25#include "llvm/IR/IntrinsicsNVPTX.h"
26#include "llvm/IR/IntrinsicsPowerPC.h"
27#include "llvm/IR/IntrinsicsR600.h"
28#include "llvm/IR/IntrinsicsRISCV.h"
29#include "llvm/IR/IntrinsicsS390.h"
30#include "llvm/IR/IntrinsicsSPIRV.h"
31#include "llvm/IR/IntrinsicsVE.h"
32#include "llvm/IR/IntrinsicsX86.h"
33#include "llvm/IR/IntrinsicsXCore.h"
41#define GET_INTRINSIC_NAME_TABLE
42#include "llvm/IR/IntrinsicImpl.inc"
45 assert(
id < num_intrinsics &&
"Invalid intrinsic ID!");
46 return IntrinsicNameTable[IntrinsicNameOffsetTable[id]];
50 assert(
id < num_intrinsics &&
"Invalid intrinsic ID!");
52 "This version of getName does not support overloading");
71 Result +=
"p" +
utostr(PTyp->getAddressSpace());
73 Result +=
"a" +
utostr(ATyp->getNumElements()) +
76 if (!STyp->isLiteral()) {
79 Result += STyp->getName();
81 HasUnnamedType =
true;
84 for (
auto *Elem : STyp->elements())
91 for (
size_t i = 0; i < FT->getNumParams(); i++)
101 Result +=
"v" +
utostr(EC.getKnownMinValue()) +
105 Result += TETy->getName();
106 for (
Type *ParamTy : TETy->type_params())
108 for (
unsigned IntParam : TETy->int_params())
109 Result +=
"_" +
utostr(IntParam);
113 switch (Ty->getTypeID()) {
120 Result +=
"Metadata";
160 bool EarlyModuleCheck) {
162 assert(Id < Intrinsic::num_intrinsics &&
"Invalid intrinsic ID!");
164 "This version of getName is for overloaded intrinsics only");
165 (void)EarlyModuleCheck;
166 assert((!EarlyModuleCheck || M ||
168 "Intrinsic overloading on pointer types need to provide a Module");
169 bool HasUnnamedType =
false;
171 for (
Type *Ty : OverloadTys)
173 if (HasUnnamedType) {
174 assert(M &&
"unnamed types need a module");
179 "Provided FunctionType must match arguments");
180 return M->getUniqueIntrinsicName(Result, Id, FT);
187 assert(M &&
"We need to have a Module");
201#define GET_INTRINSIC_IITINFO
202#include "llvm/IR/IntrinsicImpl.inc"
205static_assert(IIT_Done == 0,
"IIT_Done expected to be 0");
212 auto IsScalableVector = [&]() {
214 if (NextInfo != IIT_SCALABLE_VEC)
225 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Void, 0));
228 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::VarArg, 0));
231 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::MMX, 0));
234 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::AMX, 0));
237 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Token, 0));
240 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Metadata, 0));
243 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Half, 0));
246 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::BFloat, 0));
249 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Float, 0));
252 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Double, 0));
255 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Quad, 0));
258 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::PPCQuad, 0));
261 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 1));
264 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 2));
267 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 4));
269 case IIT_AARCH64_SVCOUNT:
270 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::AArch64Svcount, 0));
273 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 8));
276 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 16));
279 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 32));
282 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 64));
285 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 128));
288 OutputTable.
push_back(IITDescriptor::getVector(1, IsScalableVector()));
292 OutputTable.
push_back(IITDescriptor::getVector(2, IsScalableVector()));
296 OutputTable.
push_back(IITDescriptor::getVector(3, IsScalableVector()));
300 OutputTable.
push_back(IITDescriptor::getVector(4, IsScalableVector()));
304 OutputTable.
push_back(IITDescriptor::getVector(6, IsScalableVector()));
308 OutputTable.
push_back(IITDescriptor::getVector(8, IsScalableVector()));
312 OutputTable.
push_back(IITDescriptor::getVector(10, IsScalableVector()));
316 OutputTable.
push_back(IITDescriptor::getVector(16, IsScalableVector()));
320 OutputTable.
push_back(IITDescriptor::getVector(32, IsScalableVector()));
324 OutputTable.
push_back(IITDescriptor::getVector(64, IsScalableVector()));
328 OutputTable.
push_back(IITDescriptor::getVector(128, IsScalableVector()));
332 OutputTable.
push_back(IITDescriptor::getVector(256, IsScalableVector()));
336 OutputTable.
push_back(IITDescriptor::getVector(512, IsScalableVector()));
340 OutputTable.
push_back(IITDescriptor::getVector(1024, IsScalableVector()));
344 OutputTable.
push_back(IITDescriptor::getVector(2048, IsScalableVector()));
348 OutputTable.
push_back(IITDescriptor::getVector(4096, IsScalableVector()));
352 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Pointer, 10));
355 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Pointer, 20));
358 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Pointer, 0));
362 IITDescriptor::get(IITDescriptor::Pointer, Infos[NextElt++]));
365 unsigned OverloadInfo = Infos[NextElt++];
367 IITDescriptor::get(IITDescriptor::Overloaded, OverloadInfo));
370 case IIT_EXTEND_ARG: {
371 unsigned OverloadIndex = Infos[NextElt++];
373 IITDescriptor::get(IITDescriptor::Extend, OverloadIndex));
376 case IIT_TRUNC_ARG: {
377 unsigned OverloadIndex = Infos[NextElt++];
379 IITDescriptor::get(IITDescriptor::Trunc, OverloadIndex));
382 case IIT_ONE_NTH_ELTS_VEC_ARG: {
383 unsigned short OverloadIndex = Infos[NextElt++];
384 unsigned short N = Infos[NextElt++];
385 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::OneNthEltsVec,
389 case IIT_SAME_VEC_WIDTH_ARG: {
390 unsigned OverloadIndex = Infos[NextElt++];
392 IITDescriptor::get(IITDescriptor::SameVecWidth, OverloadIndex));
395 case IIT_VEC_OF_ANYPTRS_TO_ELT: {
396 unsigned short OverloadIndex = Infos[NextElt++];
397 unsigned short RefOverloadIndex = Infos[NextElt++];
398 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::VecOfAnyPtrsToElt,
403 case IIT_EMPTYSTRUCT:
404 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Struct, 0));
407 unsigned StructElts = Infos[NextElt++] + 2;
410 IITDescriptor::get(IITDescriptor::Struct, StructElts));
412 for (
unsigned i = 0; i != StructElts; ++i)
416 case IIT_SUBDIVIDE2_ARG: {
417 unsigned OverloadIndex = Infos[NextElt++];
419 IITDescriptor::get(IITDescriptor::Subdivide2, OverloadIndex));
422 case IIT_SUBDIVIDE4_ARG: {
423 unsigned OverloadIndex = Infos[NextElt++];
425 IITDescriptor::get(IITDescriptor::Subdivide4, OverloadIndex));
428 case IIT_VEC_ELEMENT: {
429 unsigned OverloadIndex = Infos[NextElt++];
431 IITDescriptor::get(IITDescriptor::VecElement, OverloadIndex));
434 case IIT_VEC_OF_BITCASTS_TO_INT: {
435 unsigned OverloadIndex = Infos[NextElt++];
437 IITDescriptor::get(IITDescriptor::VecOfBitcastsToInt, OverloadIndex));
440 case IIT_SCALABLE_VEC:
446#define GET_INTRINSIC_GENERATOR_GLOBAL
447#include "llvm/IR/IntrinsicImpl.inc"
454 constexpr unsigned FixedEncodingBits =
sizeof(FixedEncodingTy) * CHAR_BIT;
455 constexpr unsigned MSBPosition = FixedEncodingBits - 1;
457 constexpr unsigned Mask = (1U << MSBPosition) - 1;
459 FixedEncodingTy TableVal = IIT_Table[
id - 1];
469 unsigned char IITValues[FixedEncodingBits / 4 + 1] = {0};
472 unsigned NextElt = 0;
475 if (TableVal >> MSBPosition) {
477 IITEntries = IIT_LongEncodingTable;
480 NextElt = TableVal & Mask;
485 IITValues[NextElt++] = TableVal & 0xF;
489 IITEntries = IITValues;
495 while (IITEntries[NextElt] != IIT_Done)
507 case IITDescriptor::Void:
509 case IITDescriptor::VarArg:
511 case IITDescriptor::MMX:
513 case IITDescriptor::AMX:
515 case IITDescriptor::Token:
517 case IITDescriptor::Metadata:
519 case IITDescriptor::Half:
521 case IITDescriptor::BFloat:
523 case IITDescriptor::Float:
525 case IITDescriptor::Double:
527 case IITDescriptor::Quad:
529 case IITDescriptor::PPCQuad:
531 case IITDescriptor::AArch64Svcount:
534 case IITDescriptor::Integer:
536 case IITDescriptor::Vector:
539 case IITDescriptor::Pointer:
541 case IITDescriptor::Struct: {
543 for (
unsigned i = 0, e =
D.StructNumElements; i != e; ++i)
549 case IITDescriptor::Overloaded:
550 case IITDescriptor::VecOfAnyPtrsToElt:
551 return OverloadTys[
D.getOverloadIndex()];
552 case IITDescriptor::Extend: {
553 Type *Ty = OverloadTys[
D.getOverloadIndex()];
559 case IITDescriptor::Trunc: {
560 Type *Ty = OverloadTys[
D.getOverloadIndex()];
568 case IITDescriptor::Subdivide2:
569 case IITDescriptor::Subdivide4: {
570 Type *Ty = OverloadTys[
D.getOverloadIndex()];
572 assert(VTy &&
"Expected overload type to be a Vector Type");
573 int SubDivs =
D.Kind == IITDescriptor::Subdivide2 ? 1 : 2;
576 case IITDescriptor::OneNthEltsVec:
579 D.getVectorDivisor());
580 case IITDescriptor::SameVecWidth: {
582 Type *Ty = OverloadTys[
D.getOverloadIndex()];
587 case IITDescriptor::VecElement: {
588 Type *Ty = OverloadTys[
D.getOverloadIndex()];
590 return VTy->getElementType();
593 case IITDescriptor::VecOfBitcastsToInt: {
594 Type *Ty = OverloadTys[
D.getOverloadIndex()];
596 assert(VTy &&
"Expected overload type to be a Vector Type");
617 bool IsVarArg =
false;
618 if (!ArgTys.
empty() && ArgTys.
back()->isVoidTy()) {
626#define GET_INTRINSIC_OVERLOAD_TABLE
627#include "llvm/IR/IntrinsicImpl.inc"
631#define GET_INTRINSIC_SCALARIZABLE_TABLE
632#include "llvm/IR/IntrinsicImpl.inc"
636#define GET_INTRINSIC_PRETTY_PRINT_TABLE
637#include "llvm/IR/IntrinsicImpl.inc"
641#define GET_INTRINSIC_TARGET_DATA
642#include "llvm/IR/IntrinsicImpl.inc"
645 return IID > TargetInfos[0].Count;
654 assert(Name.starts_with(
"llvm.") &&
"Unexpected intrinsic prefix");
655 assert(Name.drop_front(5).starts_with(
Target) &&
"Unexpected target");
666 CmpEnd += 1 +
Target.size();
668 const unsigned *
Low = NameOffsetTable.
begin();
669 const unsigned *
High = NameOffsetTable.
end();
670 const unsigned *LastLow =
Low;
671 while (CmpEnd < Name.size() &&
High -
Low > 0) {
672 size_t CmpStart = CmpEnd;
673 CmpEnd = Name.find(
'.', CmpStart + 1);
675 auto Cmp = [CmpStart, CmpEnd](
auto LHS,
auto RHS) {
680 if constexpr (std::is_integral_v<
decltype(
LHS)>)
681 LHSStr = IntrinsicNameTable.getCString(
LHS);
686 if constexpr (std::is_integral_v<
decltype(
RHS)>)
687 RHSStr = IntrinsicNameTable.getCString(
RHS);
691 return strncmp(LHSStr + CmpStart, RHSStr + CmpStart, CmpEnd - CmpStart) <
695 std::tie(
Low,
High) = std::equal_range(
Low,
High, Name.data(), Cmp);
700 if (LastLow == NameOffsetTable.
end())
702 StringRef NameFound = IntrinsicNameTable[*LastLow];
703 if (Name == NameFound ||
704 (Name.starts_with(NameFound) && Name[NameFound.
size()] ==
'.'))
705 return LastLow - NameOffsetTable.
begin();
714static std::pair<ArrayRef<unsigned>,
StringRef>
716 assert(Name.starts_with(
"llvm."));
723 Targets, [=](
const IntrinsicTargetInfo &TI) {
return TI.Name <
Target; });
726 const auto &TI = It != Targets.
end() && It->Name ==
Target ? *It : Targets[0];
727 return {
ArrayRef(&IntrinsicNameOffsetTable[1] + TI.Offset, TI.Count),
741 int Adjust = NameOffsetTable.data() - IntrinsicNameOffsetTable;
746 const auto MatchSize = IntrinsicNameTable[NameOffsetTable[Idx]].size();
747 assert(Name.size() >= MatchSize &&
"Expected either exact or prefix match");
748 bool IsExactMatch = Name.size() == MatchSize;
754#define GET_INTRINSIC_ATTRIBUTES
755#include "llvm/IR/IntrinsicImpl.inc"
761 std::string Name = OverloadTys.
empty()
765 if (
F->getFunctionType() == FT)
773 F->setName(
F->getName() +
".invalid");
774 return cast<Function>(M->getOrInsertFunction(Name, FT).getCallee());
803 "intrinsic signature mismatch");
825#define GET_LLVM_INTRINSIC_FOR_CLANG_BUILTIN
826#include "llvm/IR/IntrinsicImpl.inc"
829#define GET_LLVM_INTRINSIC_FOR_MS_BUILTIN
830#include "llvm/IR/IntrinsicImpl.inc"
834#define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
835 case Intrinsic::INTRINSIC:
836#include "llvm/IR/ConstrainedOps.def"
846#define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
847 case Intrinsic::INTRINSIC: \
848 return ROUND_MODE == 1;
849#include "llvm/IR/ConstrainedOps.def"
857 std::pair<Type *, ArrayRef<Intrinsic::IITDescriptor>>;
863 bool IsDeferredCheck) {
871 auto InfosRef = Infos;
872 auto DeferCheck = [&DeferredChecks, &InfosRef](
Type *
T) {
880 case IITDescriptor::Void:
881 return !Ty->isVoidTy();
882 case IITDescriptor::VarArg:
884 case IITDescriptor::MMX: {
889 case IITDescriptor::AMX:
890 return !Ty->isX86_AMXTy();
891 case IITDescriptor::Token:
892 return !Ty->isTokenTy();
893 case IITDescriptor::Metadata:
894 return !Ty->isMetadataTy();
895 case IITDescriptor::Half:
896 return !Ty->isHalfTy();
897 case IITDescriptor::BFloat:
898 return !Ty->isBFloatTy();
899 case IITDescriptor::Float:
900 return !Ty->isFloatTy();
901 case IITDescriptor::Double:
902 return !Ty->isDoubleTy();
903 case IITDescriptor::Quad:
904 return !Ty->isFP128Ty();
905 case IITDescriptor::PPCQuad:
906 return !Ty->isPPC_FP128Ty();
907 case IITDescriptor::Integer:
908 return !Ty->isIntegerTy(
D.IntegerWidth);
909 case IITDescriptor::AArch64Svcount:
912 case IITDescriptor::Vector: {
914 return !VT || VT->getElementCount() !=
D.VectorWidth ||
916 DeferredChecks, IsDeferredCheck);
918 case IITDescriptor::Pointer: {
920 return !PT || PT->getAddressSpace() !=
D.PointerAddressSpace;
923 case IITDescriptor::Struct: {
925 if (!ST || !ST->isLiteral() || ST->isPacked() ||
926 ST->getNumElements() !=
D.StructNumElements)
929 for (
unsigned i = 0, e =
D.StructNumElements; i != e; ++i)
931 DeferredChecks, IsDeferredCheck))
936 case IITDescriptor::Overloaded:
939 if (
D.getOverloadIndex() < OverloadTys.
size())
940 return Ty != OverloadTys[
D.getOverloadIndex()];
942 if (
D.getOverloadIndex() > OverloadTys.
size() ||
943 D.getOverloadKind() == IITDescriptor::AK_MatchType)
944 return IsDeferredCheck || DeferCheck(Ty);
946 assert(
D.getOverloadIndex() == OverloadTys.
size() && !IsDeferredCheck &&
947 "Table consistency error");
950 switch (
D.getOverloadKind()) {
951 case IITDescriptor::AK_Any:
953 case IITDescriptor::AK_AnyInteger:
954 return !Ty->isIntOrIntVectorTy();
955 case IITDescriptor::AK_AnyFloat:
956 return !Ty->isFPOrFPVectorTy();
957 case IITDescriptor::AK_AnyVector:
959 case IITDescriptor::AK_AnyPointer:
966 case IITDescriptor::Extend: {
968 if (
D.getOverloadIndex() >= OverloadTys.
size())
969 return IsDeferredCheck || DeferCheck(Ty);
971 Type *NewTy = OverloadTys[
D.getOverloadIndex()];
981 case IITDescriptor::Trunc: {
983 if (
D.getOverloadIndex() >= OverloadTys.
size())
984 return IsDeferredCheck || DeferCheck(Ty);
986 Type *NewTy = OverloadTys[
D.getOverloadIndex()];
996 case IITDescriptor::OneNthEltsVec: {
998 if (
D.getOverloadIndex() >= OverloadTys.
size())
999 return IsDeferredCheck || DeferCheck(Ty);
1003 if (!VTy->getElementCount().isKnownMultipleOf(
D.getVectorDivisor()))
1008 case IITDescriptor::SameVecWidth: {
1009 if (
D.getOverloadIndex() >= OverloadTys.
size()) {
1012 return IsDeferredCheck || DeferCheck(Ty);
1022 if (
ReferenceType->getElementCount() != ThisArgType->getElementCount())
1024 EltTy = ThisArgType->getElementType();
1029 case IITDescriptor::VecOfAnyPtrsToElt: {
1030 unsigned RefOverloadIndex =
D.getRefOverloadIndex();
1031 if (RefOverloadIndex >= OverloadTys.
size()) {
1032 if (IsDeferredCheck)
1037 return DeferCheck(Ty);
1040 if (!IsDeferredCheck) {
1041 assert(
D.getOverloadIndex() == OverloadTys.
size() &&
1042 "Table consistency error");
1052 (
ReferenceType->getElementCount() != ThisArgVecTy->getElementCount()))
1054 return !ThisArgVecTy->getElementType()->isPointerTy();
1056 case IITDescriptor::VecElement: {
1057 if (
D.getOverloadIndex() >= OverloadTys.
size())
1058 return IsDeferredCheck ?
true : DeferCheck(Ty);
1063 case IITDescriptor::Subdivide2:
1064 case IITDescriptor::Subdivide4: {
1066 if (
D.getOverloadIndex() >= OverloadTys.
size())
1067 return IsDeferredCheck || DeferCheck(Ty);
1069 Type *NewTy = OverloadTys[
D.getOverloadIndex()];
1071 int SubDivs =
D.Kind == IITDescriptor::Subdivide2 ? 1 : 2;
1077 case IITDescriptor::VecOfBitcastsToInt: {
1078 if (
D.getOverloadIndex() >= OverloadTys.
size())
1079 return IsDeferredCheck || DeferCheck(Ty);
1097 DeferredChecks,
false))
1100 unsigned NumDeferredReturnChecks = DeferredChecks.
size();
1102 for (
auto *Ty : FTy->
params())
1106 for (
unsigned I = 0, E = DeferredChecks.
size();
I != E; ++
I) {
1109 DeferredChecks,
true))
1124 if (Infos.
size() != 1)
1162 return std::nullopt;
1166 std::string WantedName =
1168 if (Name == WantedName)
1169 return std::nullopt;
1172 if (
auto *ExistingGV =
F->getParent()->getNamedValue(WantedName)) {
1174 if (ExistingF->getFunctionType() ==
F->getFunctionType())
1181 ExistingGV->setName(WantedName +
".renamed");
1188 "Shouldn't change the signature");
1197 {Intrinsic::vector_interleave2, Intrinsic::vector_deinterleave2},
1198 {Intrinsic::vector_interleave3, Intrinsic::vector_deinterleave3},
1199 {Intrinsic::vector_interleave4, Intrinsic::vector_deinterleave4},
1200 {Intrinsic::vector_interleave5, Intrinsic::vector_deinterleave5},
1201 {Intrinsic::vector_interleave6, Intrinsic::vector_deinterleave6},
1202 {Intrinsic::vector_interleave7, Intrinsic::vector_deinterleave7},
1203 {Intrinsic::vector_interleave8, Intrinsic::vector_deinterleave8},
1207 assert(Factor >= 2 && Factor <= 8 &&
"Unexpected factor");
1212 assert(Factor >= 2 && Factor <= 8 &&
"Unexpected factor");
1216#define GET_INTRINSIC_PRETTY_PRINT_ARGUMENTS
1217#include "llvm/IR/IntrinsicImpl.inc"
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
ArrayRef< TableEntry > TableRef
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
Module.h This file contains the declarations for the Module class.
static InterleaveIntrinsic InterleaveIntrinsics[]
static bool matchIntrinsicType(Type *Ty, ArrayRef< Intrinsic::IITDescriptor > &Infos, SmallVectorImpl< Type * > &OverloadTys, SmallVectorImpl< DeferredIntrinsicMatchPair > &DeferredChecks, bool IsDeferredCheck)
static std::pair< ArrayRef< unsigned >, StringRef > findTargetSubtable(StringRef Name)
Find the segment of IntrinsicNameOffsetTable for intrinsics with the same target as Name,...
static Function * getOrInsertIntrinsicDeclarationImpl(Module *M, Intrinsic::ID id, ArrayRef< Type * > OverloadTys, FunctionType *FT)
std::pair< Type *, ArrayRef< Intrinsic::IITDescriptor > > DeferredIntrinsicMatchPair
static void DecodeIITType(unsigned &NextElt, ArrayRef< unsigned char > Infos, SmallVectorImpl< Intrinsic::IITDescriptor > &OutputTable)
static std::string getIntrinsicNameImpl(Intrinsic::ID Id, ArrayRef< Type * > OverloadTys, Module *M, FunctionType *FT, bool EarlyModuleCheck)
IIT_Info
IIT_Info - These are enumerators that describe the entries returned by the getIntrinsicInfoTableEntri...
static Type * DecodeFixedType(ArrayRef< Intrinsic::IITDescriptor > &Infos, ArrayRef< Type * > OverloadTys, LLVMContext &Context)
static int lookupLLVMIntrinsicByName(ArrayRef< unsigned > NameOffsetTable, StringRef Name, StringRef Target="")
Looks up Name in NameTable via binary search.
static std::string getMangledTypeStr(Type *Ty, bool &HasUnnamedType)
Returns a stable mangling for the type specified for use in the name mangling scheme used by 'any' ty...
This file contains the definitions of the enumerations and flags associated with NVVM Intrinsics,...
static StringRef getName(Value *V)
static SymbolRef::Type getType(const Symbol *Sym)
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
bool empty() const
empty - Check if the array is empty.
const T & consume_front()
consume_front() - Returns the first element and drops it from ArrayRef.
Class to represent fixed width SIMD vectors.
unsigned getNumElements() const
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
Class to represent function types.
ArrayRef< Type * > params() const
Type * getReturnType() const
static LLVM_ABI FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
FunctionType * getFunctionType() const
Returns the FunctionType for me.
const Function & getFunction() const
void setCallingConv(CallingConv::ID CC)
Class to represent integer types.
static LLVM_ABI IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
This is an important class for using LLVM in a threaded context.
A Module instance is used to store all the information related to an LLVM module.
static LLVM_ABI PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
static constexpr size_t npos
std::string str() const
str - Get the contents as an std::string.
constexpr size_t size() const
size - Get the string size.
Class to represent struct types.
static LLVM_ABI StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
Class to represent target extensions types, which are generally unintrospectable from target-independ...
static LLVM_ABI TargetExtType * get(LLVMContext &Context, StringRef Name, ArrayRef< Type * > Types={}, ArrayRef< unsigned > Ints={})
Return a target extension type having the specified name and optional type and integer parameters.
Target - Wrapper for Target specific information.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI Type * getX86_AMXTy(LLVMContext &C)
static LLVM_ABI Type * getMetadataTy(LLVMContext &C)
static LLVM_ABI Type * getTokenTy(LLVMContext &C)
static LLVM_ABI Type * getPPC_FP128Ty(LLVMContext &C)
static LLVM_ABI Type * getFP128Ty(LLVMContext &C)
@ X86_AMXTyID
AMX vectors (8192 bits, X86 specific)
@ HalfTyID
16-bit floating point type
@ VoidTyID
type with no size
@ FloatTyID
32-bit floating point type
@ IntegerTyID
Arbitrary bit width integers.
@ BFloatTyID
16-bit floating point type (7-bit significand)
@ DoubleTyID
64-bit floating point type
@ X86_FP80TyID
80-bit floating point type (X87)
@ PPC_FP128TyID
128-bit floating point type (two 64-bits, PowerPC)
@ ByteTyID
Arbitrary bit width bytes.
@ FP128TyID
128-bit floating point type (112-bit significand)
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
bool isIntegerTy() const
True if this is an instance of IntegerType.
static LLVM_ABI Type * getDoubleTy(LLVMContext &C)
static LLVM_ABI Type * getFloatTy(LLVMContext &C)
static LLVM_ABI Type * getBFloatTy(LLVMContext &C)
static LLVM_ABI Type * getHalfTy(LLVMContext &C)
static VectorType * getExtendedElementVectorType(VectorType *VTy)
This static method is like getInteger except that the element types are twice as wide as the elements...
static VectorType * getOneNthElementsVectorType(VectorType *VTy, unsigned Denominator)
static VectorType * getSubdividedVectorType(VectorType *VTy, int NumSubdivs)
static VectorType * getInteger(VectorType *VTy)
This static method gets a VectorType with the same number of elements as the input type,...
static VectorType * getTruncatedElementVectorType(VectorType *VTy)
static LLVM_ABI VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
Type * getElementType() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This namespace contains an enum with a value for every intrinsic/builtin function known by LLVM.
LLVM_ABI Intrinsic::ID getDeinterleaveIntrinsicID(unsigned Factor)
Returns the corresponding llvm.vector.deinterleaveN intrinsic for factor N.
LLVM_ABI void getIntrinsicInfoTableEntries(ID id, SmallVectorImpl< IITDescriptor > &T)
Return the IIT table descriptor for the specified intrinsic into an array of IITDescriptors.
MatchIntrinsicTypesResult
@ MatchIntrinsicTypes_Match
@ MatchIntrinsicTypes_NoMatchRet
@ MatchIntrinsicTypes_NoMatchArg
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 MatchIntrinsicTypesResult matchIntrinsicSignature(FunctionType *FTy, ArrayRef< IITDescriptor > &Infos, SmallVectorImpl< Type * > &OverloadTys)
Match the specified function type with the type constraints specified by the .td file.
LLVM_ABI std::optional< Function * > remangleIntrinsicFunction(Function *F)
LLVM_ABI bool hasConstrainedFPRoundingModeOperand(ID QID)
Returns true if the intrinsic ID is for one of the "ConstrainedFloating-Point Intrinsics" that take r...
LLVM_ABI StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
LLVM_ABI Function * getOrInsertDeclaration(Module *M, ID id, ArrayRef< Type * > OverloadTys={})
Look up the Function declaration of the intrinsic id in the Module M.
LLVM_ABI bool isConstrainedFPIntrinsic(ID QID)
Returns true if the intrinsic ID is for one of the "ConstrainedFloating-Point Intrinsics".
LLVM_ABI ID lookupIntrinsicID(StringRef Name)
This does the actual lookup of an intrinsic ID which matches the given function name.
LLVM_ABI bool hasPrettyPrintedArgs(ID id)
Returns true if the intrinsic has pretty printed immediate arguments.
LLVM_ABI StringRef getBaseName(ID id)
Return the LLVM name for an intrinsic, without encoded types for overloading, such as "llvm....
LLVM_ABI Intrinsic::ID getInterleaveIntrinsicID(unsigned Factor)
Returns the corresponding llvm.vector.interleaveN intrinsic for factor N.
LLVM_ABI bool isOverloaded(ID id)
Returns true if the intrinsic can be overloaded.
LLVM_ABI FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > OverloadTys={})
Return the function type for an intrinsic.
LLVM_ABI bool isTriviallyScalarizable(ID id)
Returns true if the intrinsic is trivially scalarizable.
LLVM_ABI bool getIntrinsicSignature(Intrinsic::ID, FunctionType *FT, SmallVectorImpl< Type * > &OverloadTys)
Gets the type arguments of an intrinsic call by matching type contraints specified by the ....
LLVM_ABI bool isTargetIntrinsic(ID IID)
isTargetIntrinsic - Returns true if IID is an intrinsic specific to a certain target.
LLVM_ABI std::string getNameNoUnnamedTypes(ID Id, ArrayRef< Type * > OverloadTys)
Return the LLVM name for an intrinsic.
LLVM_ABI bool matchIntrinsicVarArg(bool isVarArg, ArrayRef< IITDescriptor > &Infos)
Verify if the intrinsic has variable arguments.
This is an optimization pass for GlobalISel generic memory operations.
@ Low
Lower the current thread's priority such that it does not affect foreground tasks significantly.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
auto partition_point(R &&Range, Predicate P)
Binary search for the first iterator in a range where a predicate is false.
std::string utostr(uint64_t X, bool isNeg=false)
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
constexpr detail::IsaCheckPredicate< Types... > IsaPred
Function object wrapper for the llvm::isa type check.
Intrinsic::ID Deinterleave
This is a type descriptor which explains the type requirements of an intrinsic.