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"
43#undef GET_INTRINSIC_NAME_TABLE
46 assert(
id < num_intrinsics &&
"Invalid intrinsic ID!");
47 return IntrinsicNameTable[IntrinsicNameOffsetTable[id]];
51 assert(
id < num_intrinsics &&
"Invalid intrinsic ID!");
53 "This version of getName does not support overloading");
72 Result +=
"p" +
utostr(PTyp->getAddressSpace());
74 Result +=
"a" +
utostr(ATyp->getNumElements()) +
77 if (!STyp->isLiteral()) {
80 Result += STyp->getName();
82 HasUnnamedType =
true;
85 for (
auto *Elem : STyp->elements())
92 for (
size_t i = 0; i < FT->getNumParams(); i++)
102 Result +=
"v" +
utostr(EC.getKnownMinValue()) +
106 Result += TETy->getName();
107 for (
Type *ParamTy : TETy->type_params())
109 for (
unsigned IntParam : TETy->int_params())
110 Result +=
"_" +
utostr(IntParam);
114 switch (Ty->getTypeID()) {
121 Result +=
"Metadata";
157 bool EarlyModuleCheck) {
159 assert(Id < Intrinsic::num_intrinsics &&
"Invalid intrinsic ID!");
161 "This version of getName is for overloaded intrinsics only");
162 (void)EarlyModuleCheck;
163 assert((!EarlyModuleCheck || M ||
165 "Intrinsic overloading on pointer types need to provide a Module");
166 bool HasUnnamedType =
false;
170 if (HasUnnamedType) {
171 assert(M &&
"unnamed types need a module");
176 "Provided FunctionType must match arguments");
177 return M->getUniqueIntrinsicName(Result, Id, FT);
184 assert(M &&
"We need to have a Module");
197#define GET_INTRINSIC_IITINFO
198#include "llvm/IR/IntrinsicImpl.inc"
199#undef GET_INTRINSIC_IITINFO
208 bool IsScalableVector = (LastInfo == IIT_SCALABLE_VEC);
214 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Void, 0));
217 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::VarArg, 0));
220 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::MMX, 0));
223 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::AMX, 0));
226 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Token, 0));
229 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Metadata, 0));
232 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Half, 0));
235 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::BFloat, 0));
238 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Float, 0));
241 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Double, 0));
244 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Quad, 0));
247 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::PPCQuad, 0));
250 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 1));
253 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 2));
256 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 4));
258 case IIT_AARCH64_SVCOUNT:
259 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::AArch64Svcount, 0));
262 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 8));
265 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 16));
268 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 32));
271 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 64));
274 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 128));
277 OutputTable.
push_back(IITDescriptor::getVector(1, IsScalableVector));
281 OutputTable.
push_back(IITDescriptor::getVector(2, IsScalableVector));
285 OutputTable.
push_back(IITDescriptor::getVector(3, IsScalableVector));
289 OutputTable.
push_back(IITDescriptor::getVector(4, IsScalableVector));
293 OutputTable.
push_back(IITDescriptor::getVector(6, IsScalableVector));
297 OutputTable.
push_back(IITDescriptor::getVector(8, IsScalableVector));
301 OutputTable.
push_back(IITDescriptor::getVector(10, IsScalableVector));
305 OutputTable.
push_back(IITDescriptor::getVector(16, IsScalableVector));
309 OutputTable.
push_back(IITDescriptor::getVector(32, IsScalableVector));
313 OutputTable.
push_back(IITDescriptor::getVector(64, IsScalableVector));
317 OutputTable.
push_back(IITDescriptor::getVector(128, IsScalableVector));
321 OutputTable.
push_back(IITDescriptor::getVector(256, IsScalableVector));
325 OutputTable.
push_back(IITDescriptor::getVector(512, IsScalableVector));
329 OutputTable.
push_back(IITDescriptor::getVector(1024, IsScalableVector));
333 OutputTable.
push_back(IITDescriptor::getVector(2048, IsScalableVector));
337 OutputTable.
push_back(IITDescriptor::getVector(4096, IsScalableVector));
341 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Pointer, 10));
344 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Pointer, 20));
347 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Pointer, 0));
351 IITDescriptor::get(IITDescriptor::Pointer, Infos[NextElt++]));
354 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
355 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Argument,
ArgInfo));
358 case IIT_EXTEND_ARG: {
359 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
361 IITDescriptor::get(IITDescriptor::ExtendArgument,
ArgInfo));
364 case IIT_TRUNC_ARG: {
365 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
367 IITDescriptor::get(IITDescriptor::TruncArgument,
ArgInfo));
370 case IIT_ONE_NTH_ELTS_VEC_ARG: {
371 unsigned short ArgNo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
372 unsigned short N = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
374 IITDescriptor::get(IITDescriptor::OneNthEltsVecArgument,
N, ArgNo));
377 case IIT_SAME_VEC_WIDTH_ARG: {
378 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
380 IITDescriptor::get(IITDescriptor::SameVecWidthArgument,
ArgInfo));
383 case IIT_VEC_OF_ANYPTRS_TO_ELT: {
384 unsigned short ArgNo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
385 unsigned short RefNo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
387 IITDescriptor::get(IITDescriptor::VecOfAnyPtrsToElt, ArgNo, RefNo));
390 case IIT_EMPTYSTRUCT:
391 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Struct, 0));
394 unsigned StructElts = Infos[NextElt++] + 2;
397 IITDescriptor::get(IITDescriptor::Struct, StructElts));
399 for (
unsigned i = 0; i != StructElts; ++i)
403 case IIT_SUBDIVIDE2_ARG: {
404 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
406 IITDescriptor::get(IITDescriptor::Subdivide2Argument,
ArgInfo));
409 case IIT_SUBDIVIDE4_ARG: {
410 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
412 IITDescriptor::get(IITDescriptor::Subdivide4Argument,
ArgInfo));
415 case IIT_VEC_ELEMENT: {
416 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
418 IITDescriptor::get(IITDescriptor::VecElementArgument,
ArgInfo));
421 case IIT_SCALABLE_VEC: {
425 case IIT_VEC_OF_BITCASTS_TO_INT: {
426 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
428 IITDescriptor::get(IITDescriptor::VecOfBitcastsToInt,
ArgInfo));
435#define GET_INTRINSIC_GENERATOR_GLOBAL
436#include "llvm/IR/IntrinsicImpl.inc"
437#undef GET_INTRINSIC_GENERATOR_GLOBAL
441 static_assert(
sizeof(IIT_Table[0]) == 2,
442 "Expect 16-bit entries in IIT_Table");
444 uint16_t TableVal = IIT_Table[
id - 1];
449 unsigned NextElt = 0;
450 if (TableVal >> 15) {
452 IITEntries = IIT_LongEncodingTable;
455 NextElt = TableVal & 0x7fff;
464 IITEntries = IITValues;
470 while (NextElt != IITEntries.
size() && IITEntries[NextElt] != 0)
478 IITDescriptor
D = Infos.
front();
479 Infos = Infos.
slice(1);
482 case IITDescriptor::Void:
484 case IITDescriptor::VarArg:
486 case IITDescriptor::MMX:
488 case IITDescriptor::AMX:
490 case IITDescriptor::Token:
492 case IITDescriptor::Metadata:
494 case IITDescriptor::Half:
496 case IITDescriptor::BFloat:
498 case IITDescriptor::Float:
500 case IITDescriptor::Double:
502 case IITDescriptor::Quad:
504 case IITDescriptor::PPCQuad:
506 case IITDescriptor::AArch64Svcount:
509 case IITDescriptor::Integer:
511 case IITDescriptor::Vector:
514 case IITDescriptor::Pointer:
516 case IITDescriptor::Struct: {
518 for (
unsigned i = 0, e =
D.Struct_NumElements; i != e; ++i)
522 case IITDescriptor::Argument:
523 return Tys[
D.getArgumentNumber()];
524 case IITDescriptor::ExtendArgument: {
525 Type *Ty = Tys[
D.getArgumentNumber()];
531 case IITDescriptor::TruncArgument: {
532 Type *Ty = Tys[
D.getArgumentNumber()];
540 case IITDescriptor::Subdivide2Argument:
541 case IITDescriptor::Subdivide4Argument: {
542 Type *Ty = Tys[
D.getArgumentNumber()];
544 assert(VTy &&
"Expected an argument of Vector Type");
545 int SubDivs =
D.Kind == IITDescriptor::Subdivide2Argument ? 1 : 2;
548 case IITDescriptor::OneNthEltsVecArgument:
551 case IITDescriptor::SameVecWidthArgument: {
553 Type *Ty = Tys[
D.getArgumentNumber()];
558 case IITDescriptor::VecElementArgument: {
559 Type *Ty = Tys[
D.getArgumentNumber()];
561 return VTy->getElementType();
564 case IITDescriptor::VecOfBitcastsToInt: {
565 Type *Ty = Tys[
D.getArgumentNumber()];
567 assert(VTy &&
"Expected an argument of Vector Type");
570 case IITDescriptor::VecOfAnyPtrsToElt:
572 return Tys[
D.getOverloadArgNumber()];
592 if (!ArgTys.
empty() && ArgTys.
back()->isVoidTy()) {
600#define GET_INTRINSIC_OVERLOAD_TABLE
601#include "llvm/IR/IntrinsicImpl.inc"
602#undef GET_INTRINSIC_OVERLOAD_TABLE
606#define GET_INTRINSIC_PRETTY_PRINT_TABLE
607#include "llvm/IR/IntrinsicImpl.inc"
608#undef GET_INTRINSIC_PRETTY_PRINT_TABLE
612#define GET_INTRINSIC_TARGET_DATA
613#include "llvm/IR/IntrinsicImpl.inc"
614#undef GET_INTRINSIC_TARGET_DATA
617 return IID > TargetInfos[0].Count;
626 assert(Name.starts_with(
"llvm.") &&
"Unexpected intrinsic prefix");
627 assert(Name.drop_front(5).starts_with(
Target) &&
"Unexpected target");
638 CmpEnd += 1 +
Target.size();
640 const unsigned *
Low = NameOffsetTable.
begin();
641 const unsigned *
High = NameOffsetTable.
end();
642 const unsigned *LastLow =
Low;
643 while (CmpEnd < Name.size() &&
High -
Low > 0) {
644 size_t CmpStart = CmpEnd;
645 CmpEnd = Name.find(
'.', CmpStart + 1);
647 auto Cmp = [CmpStart, CmpEnd](
auto LHS,
auto RHS) {
652 if constexpr (std::is_integral_v<
decltype(
LHS)>)
653 LHSStr = IntrinsicNameTable.getCString(
LHS);
658 if constexpr (std::is_integral_v<
decltype(
RHS)>)
659 RHSStr = IntrinsicNameTable.getCString(
RHS);
663 return strncmp(LHSStr + CmpStart, RHSStr + CmpStart, CmpEnd - CmpStart) <
667 std::tie(
Low,
High) = std::equal_range(
Low,
High, Name.data(), Cmp);
672 if (LastLow == NameOffsetTable.
end())
674 StringRef NameFound = IntrinsicNameTable[*LastLow];
675 if (Name == NameFound ||
676 (Name.starts_with(NameFound) && Name[NameFound.
size()] ==
'.'))
677 return LastLow - NameOffsetTable.
begin();
686static std::pair<ArrayRef<unsigned>,
StringRef>
688 assert(Name.starts_with(
"llvm."));
695 Targets, [=](
const IntrinsicTargetInfo &TI) {
return TI.Name <
Target; });
698 const auto &TI = It != Targets.
end() && It->Name ==
Target ? *It : Targets[0];
699 return {
ArrayRef(&IntrinsicNameOffsetTable[1] + TI.Offset, TI.Count),
713 int Adjust = NameOffsetTable.data() - IntrinsicNameOffsetTable;
718 const auto MatchSize = IntrinsicNameTable[NameOffsetTable[Idx]].size();
719 assert(Name.size() >= MatchSize &&
"Expected either exact or prefix match");
720 bool IsExactMatch = Name.size() == MatchSize;
726#define GET_INTRINSIC_ATTRIBUTES
727#include "llvm/IR/IntrinsicImpl.inc"
728#undef GET_INTRINSIC_ATTRIBUTES
739 if (
F->getFunctionType() == FT)
747 F->setName(
F->getName() +
".invalid");
781 "intrinsic signature mismatch");
803#define GET_LLVM_INTRINSIC_FOR_CLANG_BUILTIN
804#include "llvm/IR/IntrinsicImpl.inc"
805#undef GET_LLVM_INTRINSIC_FOR_CLANG_BUILTIN
808#define GET_LLVM_INTRINSIC_FOR_MS_BUILTIN
809#include "llvm/IR/IntrinsicImpl.inc"
810#undef GET_LLVM_INTRINSIC_FOR_MS_BUILTIN
814#define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
815 case Intrinsic::INTRINSIC:
816#include "llvm/IR/ConstrainedOps.def"
826#define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
827 case Intrinsic::INTRINSIC: \
828 return ROUND_MODE == 1;
829#include "llvm/IR/ConstrainedOps.def"
837 std::pair<Type *, ArrayRef<Intrinsic::IITDescriptor>>;
843 bool IsDeferredCheck) {
851 auto InfosRef = Infos;
852 auto DeferCheck = [&DeferredChecks, &InfosRef](
Type *
T) {
857 IITDescriptor
D = Infos.
front();
858 Infos = Infos.
slice(1);
861 case IITDescriptor::Void:
862 return !Ty->isVoidTy();
863 case IITDescriptor::VarArg:
865 case IITDescriptor::MMX: {
870 case IITDescriptor::AMX:
871 return !Ty->isX86_AMXTy();
872 case IITDescriptor::Token:
873 return !Ty->isTokenTy();
874 case IITDescriptor::Metadata:
875 return !Ty->isMetadataTy();
876 case IITDescriptor::Half:
877 return !Ty->isHalfTy();
878 case IITDescriptor::BFloat:
879 return !Ty->isBFloatTy();
880 case IITDescriptor::Float:
881 return !Ty->isFloatTy();
882 case IITDescriptor::Double:
883 return !Ty->isDoubleTy();
884 case IITDescriptor::Quad:
885 return !Ty->isFP128Ty();
886 case IITDescriptor::PPCQuad:
887 return !Ty->isPPC_FP128Ty();
888 case IITDescriptor::Integer:
889 return !Ty->isIntegerTy(
D.Integer_Width);
890 case IITDescriptor::AArch64Svcount:
893 case IITDescriptor::Vector: {
895 return !VT || VT->getElementCount() !=
D.Vector_Width ||
897 DeferredChecks, IsDeferredCheck);
899 case IITDescriptor::Pointer: {
901 return !PT || PT->getAddressSpace() !=
D.Pointer_AddressSpace;
904 case IITDescriptor::Struct: {
906 if (!ST || !ST->isLiteral() || ST->isPacked() ||
907 ST->getNumElements() !=
D.Struct_NumElements)
910 for (
unsigned i = 0, e =
D.Struct_NumElements; i != e; ++i)
912 DeferredChecks, IsDeferredCheck))
917 case IITDescriptor::Argument:
920 if (
D.getArgumentNumber() < ArgTys.
size())
921 return Ty != ArgTys[
D.getArgumentNumber()];
923 if (
D.getArgumentNumber() > ArgTys.
size() ||
924 D.getArgumentKind() == IITDescriptor::AK_MatchType)
925 return IsDeferredCheck || DeferCheck(Ty);
927 assert(
D.getArgumentNumber() == ArgTys.
size() && !IsDeferredCheck &&
928 "Table consistency error");
931 switch (
D.getArgumentKind()) {
932 case IITDescriptor::AK_Any:
934 case IITDescriptor::AK_AnyInteger:
935 return !Ty->isIntOrIntVectorTy();
936 case IITDescriptor::AK_AnyFloat:
937 return !Ty->isFPOrFPVectorTy();
938 case IITDescriptor::AK_AnyVector:
940 case IITDescriptor::AK_AnyPointer:
947 case IITDescriptor::ExtendArgument: {
949 if (
D.getArgumentNumber() >= ArgTys.
size())
950 return IsDeferredCheck || DeferCheck(Ty);
952 Type *NewTy = ArgTys[
D.getArgumentNumber()];
962 case IITDescriptor::TruncArgument: {
964 if (
D.getArgumentNumber() >= ArgTys.
size())
965 return IsDeferredCheck || DeferCheck(Ty);
967 Type *NewTy = ArgTys[
D.getArgumentNumber()];
977 case IITDescriptor::OneNthEltsVecArgument:
979 if (
D.getRefArgNumber() >= ArgTys.
size())
980 return IsDeferredCheck || DeferCheck(Ty);
984 D.getVectorDivisor()) != Ty;
985 case IITDescriptor::SameVecWidthArgument: {
986 if (
D.getArgumentNumber() >= ArgTys.
size()) {
988 Infos = Infos.
slice(1);
989 return IsDeferredCheck || DeferCheck(Ty);
998 if (
ReferenceType->getElementCount() != ThisArgType->getElementCount())
1000 EltTy = ThisArgType->getElementType();
1005 case IITDescriptor::VecOfAnyPtrsToElt: {
1006 unsigned RefArgNumber =
D.getRefArgNumber();
1007 if (RefArgNumber >= ArgTys.
size()) {
1008 if (IsDeferredCheck)
1013 return DeferCheck(Ty);
1016 if (!IsDeferredCheck) {
1017 assert(
D.getOverloadArgNumber() == ArgTys.
size() &&
1018 "Table consistency error");
1028 (
ReferenceType->getElementCount() != ThisArgVecTy->getElementCount()))
1030 return !ThisArgVecTy->getElementType()->isPointerTy();
1032 case IITDescriptor::VecElementArgument: {
1033 if (
D.getArgumentNumber() >= ArgTys.
size())
1034 return IsDeferredCheck ?
true : DeferCheck(Ty);
1038 case IITDescriptor::Subdivide2Argument:
1039 case IITDescriptor::Subdivide4Argument: {
1041 if (
D.getArgumentNumber() >= ArgTys.
size())
1042 return IsDeferredCheck || DeferCheck(Ty);
1044 Type *NewTy = ArgTys[
D.getArgumentNumber()];
1046 int SubDivs =
D.Kind == IITDescriptor::Subdivide2Argument ? 1 : 2;
1052 case IITDescriptor::VecOfBitcastsToInt: {
1053 if (
D.getArgumentNumber() >= ArgTys.
size())
1054 return IsDeferredCheck || DeferCheck(Ty);
1074 unsigned NumDeferredReturnChecks = DeferredChecks.
size();
1076 for (
auto *Ty : FTy->
params())
1080 for (
unsigned I = 0, E = DeferredChecks.
size();
I != E; ++
I) {
1098 if (Infos.
size() != 1)
1103 Infos = Infos.
slice(1);
1137 return std::nullopt;
1141 std::string WantedName =
1143 if (Name == WantedName)
1144 return std::nullopt;
1147 if (
auto *ExistingGV =
F->getParent()->getNamedValue(WantedName)) {
1149 if (ExistingF->getFunctionType() ==
F->getFunctionType())
1156 ExistingGV->setName(WantedName +
".renamed");
1163 "Shouldn't change the signature");
1172 {Intrinsic::vector_interleave2, Intrinsic::vector_deinterleave2},
1173 {Intrinsic::vector_interleave3, Intrinsic::vector_deinterleave3},
1174 {Intrinsic::vector_interleave4, Intrinsic::vector_deinterleave4},
1175 {Intrinsic::vector_interleave5, Intrinsic::vector_deinterleave5},
1176 {Intrinsic::vector_interleave6, Intrinsic::vector_deinterleave6},
1177 {Intrinsic::vector_interleave7, Intrinsic::vector_deinterleave7},
1178 {Intrinsic::vector_interleave8, Intrinsic::vector_deinterleave8},
1182 assert(Factor >= 2 && Factor <= 8 &&
"Unexpected factor");
1187 assert(Factor >= 2 && Factor <= 8 &&
"Unexpected factor");
1191#define GET_INTRINSIC_PRETTY_PRINT_ARGUMENTS
1192#include "llvm/IR/IntrinsicImpl.inc"
1193#undef GET_INTRINSIC_PRETTY_PRINT_ARGUMENTS
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 Function * getOrInsertIntrinsicDeclarationImpl(Module *M, Intrinsic::ID id, ArrayRef< Type * > Tys, FunctionType *FT)
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...
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),...
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.
static constexpr size_t npos
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)
@ 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 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 * > 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.