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"
211 bool IsScalableVector = LastInfo == IIT_SCALABLE_VEC;
217 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Void, 0));
220 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::VarArg, 0));
223 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::MMX, 0));
226 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::AMX, 0));
229 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Token, 0));
232 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Metadata, 0));
235 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Half, 0));
238 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::BFloat, 0));
241 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Float, 0));
244 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Double, 0));
247 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Quad, 0));
250 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::PPCQuad, 0));
253 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 1));
256 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 2));
259 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 4));
261 case IIT_AARCH64_SVCOUNT:
262 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::AArch64Svcount, 0));
265 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 8));
268 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 16));
271 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 32));
274 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 64));
277 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Integer, 128));
280 OutputTable.
push_back(IITDescriptor::getVector(1, IsScalableVector));
284 OutputTable.
push_back(IITDescriptor::getVector(2, IsScalableVector));
288 OutputTable.
push_back(IITDescriptor::getVector(3, IsScalableVector));
292 OutputTable.
push_back(IITDescriptor::getVector(4, IsScalableVector));
296 OutputTable.
push_back(IITDescriptor::getVector(6, IsScalableVector));
300 OutputTable.
push_back(IITDescriptor::getVector(8, IsScalableVector));
304 OutputTable.
push_back(IITDescriptor::getVector(10, IsScalableVector));
308 OutputTable.
push_back(IITDescriptor::getVector(16, IsScalableVector));
312 OutputTable.
push_back(IITDescriptor::getVector(32, IsScalableVector));
316 OutputTable.
push_back(IITDescriptor::getVector(64, IsScalableVector));
320 OutputTable.
push_back(IITDescriptor::getVector(128, IsScalableVector));
324 OutputTable.
push_back(IITDescriptor::getVector(256, IsScalableVector));
328 OutputTable.
push_back(IITDescriptor::getVector(512, IsScalableVector));
332 OutputTable.
push_back(IITDescriptor::getVector(1024, IsScalableVector));
336 OutputTable.
push_back(IITDescriptor::getVector(2048, IsScalableVector));
340 OutputTable.
push_back(IITDescriptor::getVector(4096, IsScalableVector));
344 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Pointer, 10));
347 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Pointer, 20));
350 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Pointer, 0));
354 IITDescriptor::get(IITDescriptor::Pointer, Infos[NextElt++]));
357 unsigned OverloadInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
359 IITDescriptor::get(IITDescriptor::Overloaded, OverloadInfo));
362 case IIT_EXTEND_ARG: {
363 unsigned OverloadIndex = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
365 IITDescriptor::get(IITDescriptor::Extend, OverloadIndex));
368 case IIT_TRUNC_ARG: {
369 unsigned OverloadIndex = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
371 IITDescriptor::get(IITDescriptor::Trunc, OverloadIndex));
374 case IIT_ONE_NTH_ELTS_VEC_ARG: {
375 unsigned short OverloadIndex =
376 (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
377 unsigned short N = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
378 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::OneNthEltsVec,
382 case IIT_SAME_VEC_WIDTH_ARG: {
383 unsigned OverloadIndex = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
385 IITDescriptor::get(IITDescriptor::SameVecWidth, OverloadIndex));
388 case IIT_VEC_OF_ANYPTRS_TO_ELT: {
389 unsigned short OverloadIndex =
390 (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
391 unsigned short RefOverloadIndex =
392 (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
393 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::VecOfAnyPtrsToElt,
398 case IIT_EMPTYSTRUCT:
399 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Struct, 0));
402 unsigned StructElts = Infos[NextElt++] + 2;
405 IITDescriptor::get(IITDescriptor::Struct, StructElts));
407 for (
unsigned i = 0; i != StructElts; ++i)
411 case IIT_SUBDIVIDE2_ARG: {
412 unsigned OverloadIndex = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
414 IITDescriptor::get(IITDescriptor::Subdivide2, OverloadIndex));
417 case IIT_SUBDIVIDE4_ARG: {
418 unsigned OverloadIndex = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
420 IITDescriptor::get(IITDescriptor::Subdivide4, OverloadIndex));
423 case IIT_VEC_ELEMENT: {
424 unsigned OverloadIndex = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
426 IITDescriptor::get(IITDescriptor::VecElement, OverloadIndex));
429 case IIT_SCALABLE_VEC: {
433 case IIT_VEC_OF_BITCASTS_TO_INT: {
434 unsigned OverloadIndex = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
436 IITDescriptor::get(IITDescriptor::VecOfBitcastsToInt, OverloadIndex));
443#define GET_INTRINSIC_GENERATOR_GLOBAL
444#include "llvm/IR/IntrinsicImpl.inc"
451 constexpr unsigned FixedEncodingBits =
sizeof(FixedEncodingTy) * CHAR_BIT;
452 constexpr unsigned MSBPosition = FixedEncodingBits - 1;
454 constexpr unsigned Mask = (1U << MSBPosition) - 1;
456 FixedEncodingTy TableVal = IIT_Table[
id - 1];
461 unsigned char IITValues[FixedEncodingBits / 4];
464 unsigned NextElt = 0;
467 if (TableVal >> MSBPosition) {
469 IITEntries = IIT_LongEncodingTable;
472 NextElt = TableVal & Mask;
477 IITValues[NextElt++] = TableVal & 0xF;
487 while (NextElt != IITEntries.
size() && IITEntries[NextElt] != 0)
496 IITDescriptor
D = Infos.
front();
497 Infos = Infos.
slice(1);
500 case IITDescriptor::Void:
502 case IITDescriptor::VarArg:
504 case IITDescriptor::MMX:
506 case IITDescriptor::AMX:
508 case IITDescriptor::Token:
510 case IITDescriptor::Metadata:
512 case IITDescriptor::Half:
514 case IITDescriptor::BFloat:
516 case IITDescriptor::Float:
518 case IITDescriptor::Double:
520 case IITDescriptor::Quad:
522 case IITDescriptor::PPCQuad:
524 case IITDescriptor::AArch64Svcount:
527 case IITDescriptor::Integer:
529 case IITDescriptor::Vector:
532 case IITDescriptor::Pointer:
534 case IITDescriptor::Struct: {
536 for (
unsigned i = 0, e =
D.StructNumElements; i != e; ++i)
542 case IITDescriptor::Overloaded:
543 case IITDescriptor::VecOfAnyPtrsToElt:
544 return OverloadTys[
D.getOverloadIndex()];
545 case IITDescriptor::Extend: {
546 Type *Ty = OverloadTys[
D.getOverloadIndex()];
552 case IITDescriptor::Trunc: {
553 Type *Ty = OverloadTys[
D.getOverloadIndex()];
561 case IITDescriptor::Subdivide2:
562 case IITDescriptor::Subdivide4: {
563 Type *Ty = OverloadTys[
D.getOverloadIndex()];
565 assert(VTy &&
"Expected overload type to be a Vector Type");
566 int SubDivs =
D.Kind == IITDescriptor::Subdivide2 ? 1 : 2;
569 case IITDescriptor::OneNthEltsVec:
572 D.getVectorDivisor());
573 case IITDescriptor::SameVecWidth: {
575 Type *Ty = OverloadTys[
D.getOverloadIndex()];
580 case IITDescriptor::VecElement: {
581 Type *Ty = OverloadTys[
D.getOverloadIndex()];
583 return VTy->getElementType();
586 case IITDescriptor::VecOfBitcastsToInt: {
587 Type *Ty = OverloadTys[
D.getOverloadIndex()];
589 assert(VTy &&
"Expected overload type to be a Vector Type");
610 bool IsVarArg =
false;
611 if (!ArgTys.
empty() && ArgTys.
back()->isVoidTy()) {
619#define GET_INTRINSIC_OVERLOAD_TABLE
620#include "llvm/IR/IntrinsicImpl.inc"
624#define GET_INTRINSIC_PRETTY_PRINT_TABLE
625#include "llvm/IR/IntrinsicImpl.inc"
629#define GET_INTRINSIC_TARGET_DATA
630#include "llvm/IR/IntrinsicImpl.inc"
633 return IID > TargetInfos[0].Count;
642 assert(Name.starts_with(
"llvm.") &&
"Unexpected intrinsic prefix");
643 assert(Name.drop_front(5).starts_with(
Target) &&
"Unexpected target");
654 CmpEnd += 1 +
Target.size();
656 const unsigned *
Low = NameOffsetTable.
begin();
657 const unsigned *
High = NameOffsetTable.
end();
658 const unsigned *LastLow =
Low;
659 while (CmpEnd < Name.size() &&
High -
Low > 0) {
660 size_t CmpStart = CmpEnd;
661 CmpEnd = Name.find(
'.', CmpStart + 1);
663 auto Cmp = [CmpStart, CmpEnd](
auto LHS,
auto RHS) {
668 if constexpr (std::is_integral_v<
decltype(
LHS)>)
669 LHSStr = IntrinsicNameTable.getCString(
LHS);
674 if constexpr (std::is_integral_v<
decltype(
RHS)>)
675 RHSStr = IntrinsicNameTable.getCString(
RHS);
679 return strncmp(LHSStr + CmpStart, RHSStr + CmpStart, CmpEnd - CmpStart) <
683 std::tie(
Low,
High) = std::equal_range(
Low,
High, Name.data(), Cmp);
688 if (LastLow == NameOffsetTable.
end())
690 StringRef NameFound = IntrinsicNameTable[*LastLow];
691 if (Name == NameFound ||
692 (Name.starts_with(NameFound) && Name[NameFound.
size()] ==
'.'))
693 return LastLow - NameOffsetTable.
begin();
702static std::pair<ArrayRef<unsigned>,
StringRef>
704 assert(Name.starts_with(
"llvm."));
711 Targets, [=](
const IntrinsicTargetInfo &TI) {
return TI.Name <
Target; });
714 const auto &TI = It != Targets.
end() && It->Name ==
Target ? *It : Targets[0];
715 return {
ArrayRef(&IntrinsicNameOffsetTable[1] + TI.Offset, TI.Count),
729 int Adjust = NameOffsetTable.data() - IntrinsicNameOffsetTable;
734 const auto MatchSize = IntrinsicNameTable[NameOffsetTable[Idx]].size();
735 assert(Name.size() >= MatchSize &&
"Expected either exact or prefix match");
736 bool IsExactMatch = Name.size() == MatchSize;
742#define GET_INTRINSIC_ATTRIBUTES
743#include "llvm/IR/IntrinsicImpl.inc"
749 std::string Name = OverloadTys.
empty()
753 if (
F->getFunctionType() == FT)
761 F->setName(
F->getName() +
".invalid");
762 return cast<Function>(M->getOrInsertFunction(Name, FT).getCallee());
791 "intrinsic signature mismatch");
813#define GET_LLVM_INTRINSIC_FOR_CLANG_BUILTIN
814#include "llvm/IR/IntrinsicImpl.inc"
817#define GET_LLVM_INTRINSIC_FOR_MS_BUILTIN
818#include "llvm/IR/IntrinsicImpl.inc"
822#define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
823 case Intrinsic::INTRINSIC:
824#include "llvm/IR/ConstrainedOps.def"
834#define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
835 case Intrinsic::INTRINSIC: \
836 return ROUND_MODE == 1;
837#include "llvm/IR/ConstrainedOps.def"
845 std::pair<Type *, ArrayRef<Intrinsic::IITDescriptor>>;
851 bool IsDeferredCheck) {
859 auto InfosRef = Infos;
860 auto DeferCheck = [&DeferredChecks, &InfosRef](
Type *
T) {
865 IITDescriptor
D = Infos.
front();
866 Infos = Infos.
slice(1);
869 case IITDescriptor::Void:
870 return !Ty->isVoidTy();
871 case IITDescriptor::VarArg:
873 case IITDescriptor::MMX: {
878 case IITDescriptor::AMX:
879 return !Ty->isX86_AMXTy();
880 case IITDescriptor::Token:
881 return !Ty->isTokenTy();
882 case IITDescriptor::Metadata:
883 return !Ty->isMetadataTy();
884 case IITDescriptor::Half:
885 return !Ty->isHalfTy();
886 case IITDescriptor::BFloat:
887 return !Ty->isBFloatTy();
888 case IITDescriptor::Float:
889 return !Ty->isFloatTy();
890 case IITDescriptor::Double:
891 return !Ty->isDoubleTy();
892 case IITDescriptor::Quad:
893 return !Ty->isFP128Ty();
894 case IITDescriptor::PPCQuad:
895 return !Ty->isPPC_FP128Ty();
896 case IITDescriptor::Integer:
897 return !Ty->isIntegerTy(
D.IntegerWidth);
898 case IITDescriptor::AArch64Svcount:
901 case IITDescriptor::Vector: {
903 return !VT || VT->getElementCount() !=
D.VectorWidth ||
905 DeferredChecks, IsDeferredCheck);
907 case IITDescriptor::Pointer: {
909 return !PT || PT->getAddressSpace() !=
D.PointerAddressSpace;
912 case IITDescriptor::Struct: {
914 if (!ST || !ST->isLiteral() || ST->isPacked() ||
915 ST->getNumElements() !=
D.StructNumElements)
918 for (
unsigned i = 0, e =
D.StructNumElements; i != e; ++i)
920 DeferredChecks, IsDeferredCheck))
925 case IITDescriptor::Overloaded:
928 if (
D.getOverloadIndex() < OverloadTys.
size())
929 return Ty != OverloadTys[
D.getOverloadIndex()];
931 if (
D.getOverloadIndex() > OverloadTys.
size() ||
932 D.getOverloadKind() == IITDescriptor::AK_MatchType)
933 return IsDeferredCheck || DeferCheck(Ty);
935 assert(
D.getOverloadIndex() == OverloadTys.
size() && !IsDeferredCheck &&
936 "Table consistency error");
939 switch (
D.getOverloadKind()) {
940 case IITDescriptor::AK_Any:
942 case IITDescriptor::AK_AnyInteger:
943 return !Ty->isIntOrIntVectorTy();
944 case IITDescriptor::AK_AnyFloat:
945 return !Ty->isFPOrFPVectorTy();
946 case IITDescriptor::AK_AnyVector:
948 case IITDescriptor::AK_AnyPointer:
955 case IITDescriptor::Extend: {
957 if (
D.getOverloadIndex() >= OverloadTys.
size())
958 return IsDeferredCheck || DeferCheck(Ty);
960 Type *NewTy = OverloadTys[
D.getOverloadIndex()];
970 case IITDescriptor::Trunc: {
972 if (
D.getOverloadIndex() >= OverloadTys.
size())
973 return IsDeferredCheck || DeferCheck(Ty);
975 Type *NewTy = OverloadTys[
D.getOverloadIndex()];
985 case IITDescriptor::OneNthEltsVec: {
987 if (
D.getOverloadIndex() >= OverloadTys.
size())
988 return IsDeferredCheck || DeferCheck(Ty);
992 if (!VTy->getElementCount().isKnownMultipleOf(
D.getVectorDivisor()))
997 case IITDescriptor::SameVecWidth: {
998 if (
D.getOverloadIndex() >= OverloadTys.
size()) {
1000 Infos = Infos.
slice(1);
1001 return IsDeferredCheck || DeferCheck(Ty);
1011 if (
ReferenceType->getElementCount() != ThisArgType->getElementCount())
1013 EltTy = ThisArgType->getElementType();
1018 case IITDescriptor::VecOfAnyPtrsToElt: {
1019 unsigned RefOverloadIndex =
D.getRefOverloadIndex();
1020 if (RefOverloadIndex >= OverloadTys.
size()) {
1021 if (IsDeferredCheck)
1026 return DeferCheck(Ty);
1029 if (!IsDeferredCheck) {
1030 assert(
D.getOverloadIndex() == OverloadTys.
size() &&
1031 "Table consistency error");
1041 (
ReferenceType->getElementCount() != ThisArgVecTy->getElementCount()))
1043 return !ThisArgVecTy->getElementType()->isPointerTy();
1045 case IITDescriptor::VecElement: {
1046 if (
D.getOverloadIndex() >= OverloadTys.
size())
1047 return IsDeferredCheck ?
true : DeferCheck(Ty);
1052 case IITDescriptor::Subdivide2:
1053 case IITDescriptor::Subdivide4: {
1055 if (
D.getOverloadIndex() >= OverloadTys.
size())
1056 return IsDeferredCheck || DeferCheck(Ty);
1058 Type *NewTy = OverloadTys[
D.getOverloadIndex()];
1060 int SubDivs =
D.Kind == IITDescriptor::Subdivide2 ? 1 : 2;
1066 case IITDescriptor::VecOfBitcastsToInt: {
1067 if (
D.getOverloadIndex() >= OverloadTys.
size())
1068 return IsDeferredCheck || DeferCheck(Ty);
1086 DeferredChecks,
false))
1089 unsigned NumDeferredReturnChecks = DeferredChecks.
size();
1091 for (
auto *Ty : FTy->
params())
1095 for (
unsigned I = 0, E = DeferredChecks.
size();
I != E; ++
I) {
1098 DeferredChecks,
true))
1113 if (Infos.
size() != 1)
1118 Infos = Infos.
slice(1);
1152 return std::nullopt;
1156 std::string WantedName =
1158 if (Name == WantedName)
1159 return std::nullopt;
1162 if (
auto *ExistingGV =
F->getParent()->getNamedValue(WantedName)) {
1164 if (ExistingF->getFunctionType() ==
F->getFunctionType())
1171 ExistingGV->setName(WantedName +
".renamed");
1178 "Shouldn't change the signature");
1187 {Intrinsic::vector_interleave2, Intrinsic::vector_deinterleave2},
1188 {Intrinsic::vector_interleave3, Intrinsic::vector_deinterleave3},
1189 {Intrinsic::vector_interleave4, Intrinsic::vector_deinterleave4},
1190 {Intrinsic::vector_interleave5, Intrinsic::vector_deinterleave5},
1191 {Intrinsic::vector_interleave6, Intrinsic::vector_deinterleave6},
1192 {Intrinsic::vector_interleave7, Intrinsic::vector_deinterleave7},
1193 {Intrinsic::vector_interleave8, Intrinsic::vector_deinterleave8},
1197 assert(Factor >= 2 && Factor <= 8 &&
"Unexpected factor");
1202 assert(Factor >= 2 && Factor <= 8 &&
"Unexpected factor");
1206#define GET_INTRINSIC_PRETTY_PRINT_ARGUMENTS
1207#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, IIT_Info LastInfo, 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),...
ArrayRef< T > take_front(size_t N=1) const
Return a copy of *this with only the first N elements.
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
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.
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 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.