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"
40#define GET_INTRINSIC_NAME_TABLE
41#include "llvm/IR/IntrinsicImpl.inc"
42#undef GET_INTRINSIC_NAME_TABLE
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";
156 bool EarlyModuleCheck) {
158 assert(Id < Intrinsic::num_intrinsics &&
"Invalid intrinsic ID!");
160 "This version of getName is for overloaded intrinsics only");
161 (void)EarlyModuleCheck;
162 assert((!EarlyModuleCheck || M ||
164 "Intrinsic overloading on pointer types need to provide a Module");
165 bool HasUnnamedType =
false;
169 if (HasUnnamedType) {
170 assert(M &&
"unnamed types need a module");
175 "Provided FunctionType must match arguments");
176 return M->getUniqueIntrinsicName(Result, Id, FT);
183 assert(M &&
"We need to have a Module");
196#define GET_INTRINSIC_IITINFO
197#include "llvm/IR/IntrinsicImpl.inc"
198#undef GET_INTRINSIC_IITINFO
207 bool IsScalableVector = (LastInfo == IIT_SCALABLE_VEC);
213 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Void, 0));
216 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::VarArg, 0));
219 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::MMX, 0));
222 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::AMX, 0));
225 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Token, 0));
228 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Metadata, 0));
231 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Half, 0));
234 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::BFloat, 0));
237 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Float, 0));
240 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Double, 0));
243 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Quad, 0));
246 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::PPCQuad, 0));
249 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 1));
252 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 2));
255 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 4));
257 case IIT_AARCH64_SVCOUNT:
258 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::AArch64Svcount, 0));
261 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 8));
264 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 16));
267 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 32));
270 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 64));
273 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 128));
276 OutputTable.
push_back(IITDescriptor::getVector(1, IsScalableVector));
280 OutputTable.
push_back(IITDescriptor::getVector(2, IsScalableVector));
284 OutputTable.
push_back(IITDescriptor::getVector(3, IsScalableVector));
288 OutputTable.
push_back(IITDescriptor::getVector(4, IsScalableVector));
292 OutputTable.
push_back(IITDescriptor::getVector(6, IsScalableVector));
296 OutputTable.
push_back(IITDescriptor::getVector(8, IsScalableVector));
300 OutputTable.
push_back(IITDescriptor::getVector(10, IsScalableVector));
304 OutputTable.
push_back(IITDescriptor::getVector(16, IsScalableVector));
308 OutputTable.
push_back(IITDescriptor::getVector(32, IsScalableVector));
312 OutputTable.
push_back(IITDescriptor::getVector(64, IsScalableVector));
316 OutputTable.
push_back(IITDescriptor::getVector(128, IsScalableVector));
320 OutputTable.
push_back(IITDescriptor::getVector(256, IsScalableVector));
324 OutputTable.
push_back(IITDescriptor::getVector(512, IsScalableVector));
328 OutputTable.
push_back(IITDescriptor::getVector(1024, IsScalableVector));
332 OutputTable.
push_back(IITDescriptor::getVector(2048, IsScalableVector));
336 OutputTable.
push_back(IITDescriptor::getVector(4096, IsScalableVector));
340 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Pointer, 10));
343 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Pointer, 20));
346 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Pointer, 0));
350 IITDescriptor::get(IITDescriptor::Pointer, Infos[NextElt++]));
353 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
354 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Argument,
ArgInfo));
357 case IIT_EXTEND_ARG: {
358 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
360 IITDescriptor::get(IITDescriptor::ExtendArgument,
ArgInfo));
363 case IIT_TRUNC_ARG: {
364 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
366 IITDescriptor::get(IITDescriptor::TruncArgument,
ArgInfo));
369 case IIT_ONE_NTH_ELTS_VEC_ARG: {
370 unsigned short ArgNo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
371 unsigned short N = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
373 IITDescriptor::get(IITDescriptor::OneNthEltsVecArgument,
N, ArgNo));
376 case IIT_SAME_VEC_WIDTH_ARG: {
377 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
379 IITDescriptor::get(IITDescriptor::SameVecWidthArgument,
ArgInfo));
382 case IIT_VEC_OF_ANYPTRS_TO_ELT: {
383 unsigned short ArgNo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
384 unsigned short RefNo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
386 IITDescriptor::get(IITDescriptor::VecOfAnyPtrsToElt, ArgNo, RefNo));
389 case IIT_EMPTYSTRUCT:
390 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Struct, 0));
393 unsigned StructElts = Infos[NextElt++] + 2;
396 IITDescriptor::get(IITDescriptor::Struct, StructElts));
398 for (
unsigned i = 0; i != StructElts; ++i)
402 case IIT_SUBDIVIDE2_ARG: {
403 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
405 IITDescriptor::get(IITDescriptor::Subdivide2Argument,
ArgInfo));
408 case IIT_SUBDIVIDE4_ARG: {
409 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
411 IITDescriptor::get(IITDescriptor::Subdivide4Argument,
ArgInfo));
414 case IIT_VEC_ELEMENT: {
415 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
417 IITDescriptor::get(IITDescriptor::VecElementArgument,
ArgInfo));
420 case IIT_SCALABLE_VEC: {
424 case IIT_VEC_OF_BITCASTS_TO_INT: {
425 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
427 IITDescriptor::get(IITDescriptor::VecOfBitcastsToInt,
ArgInfo));
434#define GET_INTRINSIC_GENERATOR_GLOBAL
435#include "llvm/IR/IntrinsicImpl.inc"
436#undef GET_INTRINSIC_GENERATOR_GLOBAL
440 static_assert(
sizeof(IIT_Table[0]) == 2,
441 "Expect 16-bit entries in IIT_Table");
443 uint16_t TableVal = IIT_Table[
id - 1];
448 unsigned NextElt = 0;
449 if (TableVal >> 15) {
451 IITEntries = IIT_LongEncodingTable;
454 NextElt = TableVal & 0x7fff;
463 IITEntries = IITValues;
469 while (NextElt != IITEntries.
size() && IITEntries[NextElt] != 0)
477 IITDescriptor
D = Infos.
front();
478 Infos = Infos.
slice(1);
481 case IITDescriptor::Void:
483 case IITDescriptor::VarArg:
485 case IITDescriptor::MMX:
487 case IITDescriptor::AMX:
489 case IITDescriptor::Token:
491 case IITDescriptor::Metadata:
493 case IITDescriptor::Half:
495 case IITDescriptor::BFloat:
497 case IITDescriptor::Float:
499 case IITDescriptor::Double:
501 case IITDescriptor::Quad:
503 case IITDescriptor::PPCQuad:
505 case IITDescriptor::AArch64Svcount:
508 case IITDescriptor::Integer:
510 case IITDescriptor::Vector:
513 case IITDescriptor::Pointer:
515 case IITDescriptor::Struct: {
517 for (
unsigned i = 0, e =
D.Struct_NumElements; i != e; ++i)
521 case IITDescriptor::Argument:
522 return Tys[
D.getArgumentNumber()];
523 case IITDescriptor::ExtendArgument: {
524 Type *Ty = Tys[
D.getArgumentNumber()];
530 case IITDescriptor::TruncArgument: {
531 Type *Ty = Tys[
D.getArgumentNumber()];
539 case IITDescriptor::Subdivide2Argument:
540 case IITDescriptor::Subdivide4Argument: {
541 Type *Ty = Tys[
D.getArgumentNumber()];
543 assert(VTy &&
"Expected an argument of Vector Type");
544 int SubDivs =
D.Kind == IITDescriptor::Subdivide2Argument ? 1 : 2;
547 case IITDescriptor::OneNthEltsVecArgument:
550 case IITDescriptor::SameVecWidthArgument: {
552 Type *Ty = Tys[
D.getArgumentNumber()];
557 case IITDescriptor::VecElementArgument: {
558 Type *Ty = Tys[
D.getArgumentNumber()];
560 return VTy->getElementType();
563 case IITDescriptor::VecOfBitcastsToInt: {
564 Type *Ty = Tys[
D.getArgumentNumber()];
566 assert(VTy &&
"Expected an argument of Vector Type");
569 case IITDescriptor::VecOfAnyPtrsToElt:
571 return Tys[
D.getOverloadArgNumber()];
591 if (!ArgTys.
empty() && ArgTys.
back()->isVoidTy()) {
599#define GET_INTRINSIC_OVERLOAD_TABLE
600#include "llvm/IR/IntrinsicImpl.inc"
601#undef GET_INTRINSIC_OVERLOAD_TABLE
605#define GET_INTRINSIC_TARGET_DATA
606#include "llvm/IR/IntrinsicImpl.inc"
607#undef GET_INTRINSIC_TARGET_DATA
610 return IID > TargetInfos[0].Count;
619 assert(Name.starts_with(
"llvm.") &&
"Unexpected intrinsic prefix");
620 assert(Name.drop_front(5).starts_with(
Target) &&
"Unexpected target");
631 CmpEnd += 1 +
Target.size();
633 const unsigned *
Low = NameOffsetTable.
begin();
634 const unsigned *
High = NameOffsetTable.
end();
635 const unsigned *LastLow =
Low;
636 while (CmpEnd < Name.size() &&
High -
Low > 0) {
637 size_t CmpStart = CmpEnd;
638 CmpEnd = Name.find(
'.', CmpStart + 1);
640 auto Cmp = [CmpStart, CmpEnd](
auto LHS,
auto RHS) {
645 if constexpr (std::is_integral_v<
decltype(
LHS)>)
646 LHSStr = IntrinsicNameTable.getCString(
LHS);
651 if constexpr (std::is_integral_v<
decltype(
RHS)>)
652 RHSStr = IntrinsicNameTable.getCString(
RHS);
656 return strncmp(LHSStr + CmpStart, RHSStr + CmpStart, CmpEnd - CmpStart) <
660 std::tie(
Low,
High) = std::equal_range(
Low,
High, Name.data(), Cmp);
665 if (LastLow == NameOffsetTable.
end())
667 StringRef NameFound = IntrinsicNameTable[*LastLow];
668 if (Name == NameFound ||
669 (Name.starts_with(NameFound) && Name[NameFound.
size()] ==
'.'))
670 return LastLow - NameOffsetTable.
begin();
679static std::pair<ArrayRef<unsigned>,
StringRef>
681 assert(Name.starts_with(
"llvm."));
688 Targets, [=](
const IntrinsicTargetInfo &TI) {
return TI.Name <
Target; });
691 const auto &TI = It != Targets.
end() && It->Name ==
Target ? *It : Targets[0];
692 return {
ArrayRef(&IntrinsicNameOffsetTable[1] + TI.Offset, TI.Count),
706 int Adjust = NameOffsetTable.data() - IntrinsicNameOffsetTable;
711 const auto MatchSize = IntrinsicNameTable[NameOffsetTable[Idx]].size();
712 assert(Name.size() >= MatchSize &&
"Expected either exact or prefix match");
713 bool IsExactMatch = Name.size() == MatchSize;
719#define GET_INTRINSIC_ATTRIBUTES
720#include "llvm/IR/IntrinsicImpl.inc"
721#undef GET_INTRINSIC_ATTRIBUTES
727 auto *FT =
getType(M->getContext(),
id, Tys);
729 M->getOrInsertFunction(
745#define GET_LLVM_INTRINSIC_FOR_CLANG_BUILTIN
746#include "llvm/IR/IntrinsicImpl.inc"
747#undef GET_LLVM_INTRINSIC_FOR_CLANG_BUILTIN
750#define GET_LLVM_INTRINSIC_FOR_MS_BUILTIN
751#include "llvm/IR/IntrinsicImpl.inc"
752#undef GET_LLVM_INTRINSIC_FOR_MS_BUILTIN
756#define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
757 case Intrinsic::INTRINSIC:
758#include "llvm/IR/ConstrainedOps.def"
768#define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
769 case Intrinsic::INTRINSIC: \
770 return ROUND_MODE == 1;
771#include "llvm/IR/ConstrainedOps.def"
779 std::pair<Type *, ArrayRef<Intrinsic::IITDescriptor>>;
785 bool IsDeferredCheck) {
793 auto InfosRef = Infos;
794 auto DeferCheck = [&DeferredChecks, &InfosRef](
Type *
T) {
799 IITDescriptor
D = Infos.
front();
800 Infos = Infos.
slice(1);
803 case IITDescriptor::Void:
804 return !Ty->isVoidTy();
805 case IITDescriptor::VarArg:
807 case IITDescriptor::MMX: {
812 case IITDescriptor::AMX:
813 return !Ty->isX86_AMXTy();
814 case IITDescriptor::Token:
815 return !Ty->isTokenTy();
816 case IITDescriptor::Metadata:
817 return !Ty->isMetadataTy();
818 case IITDescriptor::Half:
819 return !Ty->isHalfTy();
820 case IITDescriptor::BFloat:
821 return !Ty->isBFloatTy();
822 case IITDescriptor::Float:
823 return !Ty->isFloatTy();
824 case IITDescriptor::Double:
825 return !Ty->isDoubleTy();
826 case IITDescriptor::Quad:
827 return !Ty->isFP128Ty();
828 case IITDescriptor::PPCQuad:
829 return !Ty->isPPC_FP128Ty();
830 case IITDescriptor::Integer:
831 return !Ty->isIntegerTy(
D.Integer_Width);
832 case IITDescriptor::AArch64Svcount:
835 case IITDescriptor::Vector: {
837 return !VT || VT->getElementCount() !=
D.Vector_Width ||
839 DeferredChecks, IsDeferredCheck);
841 case IITDescriptor::Pointer: {
843 return !PT || PT->getAddressSpace() !=
D.Pointer_AddressSpace;
846 case IITDescriptor::Struct: {
848 if (!ST || !ST->isLiteral() || ST->isPacked() ||
849 ST->getNumElements() !=
D.Struct_NumElements)
852 for (
unsigned i = 0, e =
D.Struct_NumElements; i != e; ++i)
854 DeferredChecks, IsDeferredCheck))
859 case IITDescriptor::Argument:
862 if (
D.getArgumentNumber() < ArgTys.
size())
863 return Ty != ArgTys[
D.getArgumentNumber()];
865 if (
D.getArgumentNumber() > ArgTys.
size() ||
866 D.getArgumentKind() == IITDescriptor::AK_MatchType)
867 return IsDeferredCheck || DeferCheck(Ty);
869 assert(
D.getArgumentNumber() == ArgTys.
size() && !IsDeferredCheck &&
870 "Table consistency error");
873 switch (
D.getArgumentKind()) {
874 case IITDescriptor::AK_Any:
876 case IITDescriptor::AK_AnyInteger:
877 return !Ty->isIntOrIntVectorTy();
878 case IITDescriptor::AK_AnyFloat:
879 return !Ty->isFPOrFPVectorTy();
880 case IITDescriptor::AK_AnyVector:
882 case IITDescriptor::AK_AnyPointer:
889 case IITDescriptor::ExtendArgument: {
891 if (
D.getArgumentNumber() >= ArgTys.
size())
892 return IsDeferredCheck || DeferCheck(Ty);
894 Type *NewTy = ArgTys[
D.getArgumentNumber()];
904 case IITDescriptor::TruncArgument: {
906 if (
D.getArgumentNumber() >= ArgTys.
size())
907 return IsDeferredCheck || DeferCheck(Ty);
909 Type *NewTy = ArgTys[
D.getArgumentNumber()];
919 case IITDescriptor::OneNthEltsVecArgument:
921 if (
D.getRefArgNumber() >= ArgTys.
size())
922 return IsDeferredCheck || DeferCheck(Ty);
926 D.getVectorDivisor()) != Ty;
927 case IITDescriptor::SameVecWidthArgument: {
928 if (
D.getArgumentNumber() >= ArgTys.
size()) {
930 Infos = Infos.
slice(1);
931 return IsDeferredCheck || DeferCheck(Ty);
940 if (
ReferenceType->getElementCount() != ThisArgType->getElementCount())
942 EltTy = ThisArgType->getElementType();
947 case IITDescriptor::VecOfAnyPtrsToElt: {
948 unsigned RefArgNumber =
D.getRefArgNumber();
949 if (RefArgNumber >= ArgTys.
size()) {
955 return DeferCheck(Ty);
958 if (!IsDeferredCheck) {
959 assert(
D.getOverloadArgNumber() == ArgTys.
size() &&
960 "Table consistency error");
970 (
ReferenceType->getElementCount() != ThisArgVecTy->getElementCount()))
972 return !ThisArgVecTy->getElementType()->isPointerTy();
974 case IITDescriptor::VecElementArgument: {
975 if (
D.getArgumentNumber() >= ArgTys.
size())
976 return IsDeferredCheck ?
true : DeferCheck(Ty);
980 case IITDescriptor::Subdivide2Argument:
981 case IITDescriptor::Subdivide4Argument: {
983 if (
D.getArgumentNumber() >= ArgTys.
size())
984 return IsDeferredCheck || DeferCheck(Ty);
986 Type *NewTy = ArgTys[
D.getArgumentNumber()];
988 int SubDivs =
D.Kind == IITDescriptor::Subdivide2Argument ? 1 : 2;
994 case IITDescriptor::VecOfBitcastsToInt: {
995 if (
D.getArgumentNumber() >= ArgTys.
size())
996 return IsDeferredCheck || DeferCheck(Ty);
1016 unsigned NumDeferredReturnChecks = DeferredChecks.
size();
1018 for (
auto *Ty : FTy->
params())
1022 for (
unsigned I = 0, E = DeferredChecks.
size();
I != E; ++
I) {
1040 if (Infos.
size() != 1)
1045 Infos = Infos.
slice(1);
1079 return std::nullopt;
1083 std::string WantedName =
1085 if (Name == WantedName)
1086 return std::nullopt;
1089 if (
auto *ExistingGV =
F->getParent()->getNamedValue(WantedName)) {
1091 if (ExistingF->getFunctionType() ==
F->getFunctionType())
1098 ExistingGV->setName(WantedName +
".renamed");
1105 "Shouldn't change the signature");
1114 {Intrinsic::vector_interleave2, Intrinsic::vector_deinterleave2},
1115 {Intrinsic::vector_interleave3, Intrinsic::vector_deinterleave3},
1116 {Intrinsic::vector_interleave4, Intrinsic::vector_deinterleave4},
1117 {Intrinsic::vector_interleave5, Intrinsic::vector_deinterleave5},
1118 {Intrinsic::vector_interleave6, Intrinsic::vector_deinterleave6},
1119 {Intrinsic::vector_interleave7, Intrinsic::vector_deinterleave7},
1120 {Intrinsic::vector_interleave8, Intrinsic::vector_deinterleave8},
1124 assert(Factor >= 2 && Factor <= 8 &&
"Unexpected factor");
1129 assert(Factor >= 2 && Factor <= 8 &&
"Unexpected factor");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
ArrayRef< TableEntry > TableRef
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
Analysis containing CSE Info
Module.h This file contains the declarations for the Module class.
static bool matchIntrinsicType(Type *Ty, ArrayRef< Intrinsic::IITDescriptor > &Infos, SmallVectorImpl< Type * > &ArgTys, SmallVectorImpl< DeferredIntrinsicMatchPair > &DeferredChecks, bool IsDeferredCheck)
static std::string getIntrinsicNameImpl(Intrinsic::ID Id, ArrayRef< Type * > Tys, Module *M, FunctionType *FT, bool EarlyModuleCheck)
static InterleaveIntrinsic InterleaveIntrinsics[]
static std::pair< ArrayRef< unsigned >, StringRef > findTargetSubtable(StringRef Name)
Find the segment of IntrinsicNameOffsetTable for intrinsics with the same target as Name,...
std::pair< Type *, ArrayRef< Intrinsic::IITDescriptor > > DeferredIntrinsicMatchPair
static void DecodeIITType(unsigned &NextElt, ArrayRef< unsigned char > Infos, IIT_Info LastInfo, SmallVectorImpl< Intrinsic::IITDescriptor > &OutputTable)
IIT_Info
IIT_Info - These are enumerators that describe the entries returned by the getIntrinsicInfoTableEntri...
static Type * DecodeFixedType(ArrayRef< Intrinsic::IITDescriptor > &Infos, ArrayRef< Type * > Tys, 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...
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),...
const T & front() const
front - Get the first element.
size_t size() const
size - Get the array size.
bool empty() const
empty - Check if the array is empty.
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
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.
constexpr size_t size() const
size - Get the string size.
static constexpr size_t npos
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)
@ 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.
This namespace contains an enum with a value for every intrinsic/builtin function known by LLVM.
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 Intrinsic::ID getDeinterleaveIntrinsicID(unsigned Factor)
Returns the corresponding llvm.vector.deinterleaveN intrinsic for factor N.
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 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 std::string getNameNoUnnamedTypes(ID Id, ArrayRef< Type * > Tys)
Return the LLVM name for an intrinsic.
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 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 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 * > Tys={})
Return the function type for an intrinsic.
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 ....
LLVM_ABI bool isTargetIntrinsic(ID IID)
isTargetIntrinsic - Returns true if IID is an intrinsic specific to a certain target.
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.
Intrinsic::ID Deinterleave
Helper struct shared between Function Specialization and SCCP Solver.
This is a type descriptor which explains the type requirements of an intrinsic.