69 :
Value(Ty,
Value::ArgumentVal), Parent(Par), ArgNo(ArgNo) {
73 void Argument::setParent(
Function *parent) {
78 if (!
getType()->isPointerTy())
return false;
83 getType()->getPointerAddressSpace()))
89 if (!
getType()->isPointerTy())
return false;
102 if (!
getType()->isPointerTy())
return false;
107 if (!
getType()->isPointerTy())
return false;
114 assert(
getType()->isPointerTy() &&
"Only pointers have alignments");
120 "Only pointers have dereferenceable bytes");
126 "Only pointers have dereferenceable bytes");
131 if (!
getType()->isPointerTy())
return false;
136 if (!
getType()->isPointerTy())
return false;
141 if (!
getType()->isPointerTy())
return false;
146 if (!
getType()->isPointerTy())
return false;
199 unsigned NumInstrs = 0;
201 NumInstrs += std::distance(BB.instructionsWithoutDebug().begin(),
202 BB.instructionsWithoutDebug().end());
207 getParent()->getFunctionList().remove(getIterator());
211 getParent()->getFunctionList().erase(getIterator());
224 "invalid return type");
225 setGlobalObjectSubClassData(0);
229 SymTab = make_unique<ValueSymbolTable>();
257 void Function::BuildLazyArguments()
const {
259 auto *FT = getFunctionType();
261 Arguments = std::allocator<Argument>().allocate(NumArgs);
262 for (
unsigned i = 0, e = NumArgs; i != e; ++i) {
263 Type *ArgTy = FT->getParamType(i);
264 assert(!ArgTy->
isVoidTy() &&
"Cannot have void typed arguments!");
272 assert(!hasLazyArguments());
279 void Function::clearArguments() {
284 std::allocator<Argument>().deallocate(
Arguments, NumArgs);
289 assert(isDeclaration() &&
"Expected no references to current arguments");
292 if (!hasLazyArguments()) {
295 "Expected arguments to be unused in declaration");
307 Src.Arguments =
nullptr;
321 assert(!hasLazyArguments());
334 setIsMaterializable(
false);
341 while (!BasicBlocks.empty())
342 BasicBlocks.begin()->eraseFromParent();
345 if (getNumOperands()) {
347 setNumHungOffUseOperands(0);
453 assert(hasGC() &&
"Function has no collector");
458 setValueSubclassDataBit(14, !Str.empty());
466 setValueSubclassDataBit(14,
false);
490 #define GET_INTRINSIC_NAME_TABLE 491 #include "llvm/IR/IntrinsicImpl.inc" 492 #undef GET_INTRINSIC_NAME_TABLE 496 #define GET_INTRINSIC_TARGET_DATA 497 #include "llvm/IR/IntrinsicImpl.inc" 498 #undef GET_INTRINSIC_TARGET_DATA 512 [](
const IntrinsicTargetInfo &TI,
513 StringRef Target) {
return TI.Name < Target; });
516 const auto &TI = It != Targets.end() && It->Name == Target ? *It : Targets[0];
517 return makeArrayRef(&IntrinsicNameTable[1] + TI.Offset, TI.Count);
535 const auto MatchSize = strlen(NameTable[Idx]);
536 assert(Name.
size() >= MatchSize &&
"Expected either exact or prefix match");
537 bool IsExactMatch = Name.
size() == MatchSize;
544 HasLLVMReservedName =
false;
548 HasLLVMReservedName =
true;
549 IntID = lookupIntrinsicID(Name);
565 if (
PointerType* PTyp = dyn_cast<PointerType>(Ty)) {
566 Result +=
"p" +
utostr(PTyp->getAddressSpace()) +
568 }
else if (
ArrayType* ATyp = dyn_cast<ArrayType>(Ty)) {
569 Result +=
"a" +
utostr(ATyp->getNumElements()) +
571 }
else if (
StructType *STyp = dyn_cast<StructType>(Ty)) {
572 if (!STyp->isLiteral()) {
574 Result += STyp->getName();
577 for (
auto Elem : STyp->elements())
582 }
else if (
FunctionType *FT = dyn_cast<FunctionType>(Ty)) {
584 for (
size_t i = 0; i < FT->getNumParams(); i++)
590 }
else if (isa<VectorType>(Ty)) {
616 "This version of getName does not support overloading");
617 return IntrinsicNameTable[id];
622 std::string
Result(IntrinsicNameTable[
id]);
623 for (
Type *Ty : Tys) {
683 using namespace Intrinsic;
686 unsigned StructElts = 2;
690 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Void, 0));
693 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::VarArg, 0));
696 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::MMX, 0));
699 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Token, 0));
705 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Half, 0));
708 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Float, 0));
711 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Double, 0));
714 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Quad, 0));
735 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Vector, 1));
739 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Vector, 2));
743 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Vector, 4));
747 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Vector, 8));
751 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Vector, 16));
755 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Vector, 32));
759 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Vector, 64));
763 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Vector, 512));
767 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Vector, 1024));
771 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Pointer, 0));
775 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Pointer,
781 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
782 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Argument, ArgInfo));
786 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
787 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::ExtendArgument,
792 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
793 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::TruncArgument,
798 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
799 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::HalfVecArgument,
804 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
805 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::SameVecWidthArgument,
810 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
811 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::PtrToArgument,
816 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
817 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::PtrToElt, ArgInfo));
821 unsigned short ArgNo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
822 unsigned short RefNo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
824 IITDescriptor::get(IITDescriptor::VecOfAnyPtrsToElt, ArgNo, RefNo));
828 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Struct, 0));
837 OutputTable.
push_back(IITDescriptor::get(IITDescriptor::Struct,StructElts));
839 for (
unsigned i = 0; i != StructElts; ++i)
847 #define GET_INTRINSIC_GENERATOR_GLOBAL 848 #include "llvm/IR/IntrinsicImpl.inc" 849 #undef GET_INTRINSIC_GENERATOR_GLOBAL 854 unsigned TableVal = IIT_Table[
id-1];
859 unsigned NextElt = 0;
860 if ((TableVal >> 31) != 0) {
862 IITEntries = IIT_LongEncodingTable;
865 NextElt = (TableVal << 1) >> 1;
874 IITEntries = IITValues;
880 while (NextElt != IITEntries.
size() && IITEntries[NextElt] != 0)
886 using namespace Intrinsic;
888 IITDescriptor
D = Infos.
front();
889 Infos = Infos.
slice(1);
904 case IITDescriptor::Vector:
906 case IITDescriptor::Pointer:
908 D.Pointer_AddressSpace);
909 case IITDescriptor::Struct: {
911 for (
unsigned i = 0, e = D.Struct_NumElements; i != e; ++i)
915 case IITDescriptor::Argument:
916 return Tys[D.getArgumentNumber()];
917 case IITDescriptor::ExtendArgument: {
918 Type *Ty = Tys[D.getArgumentNumber()];
919 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
924 case IITDescriptor::TruncArgument: {
925 Type *Ty = Tys[D.getArgumentNumber()];
926 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
933 case IITDescriptor::HalfVecArgument:
935 Tys[D.getArgumentNumber()]));
936 case IITDescriptor::SameVecWidthArgument: {
938 Type *Ty = Tys[D.getArgumentNumber()];
939 if (
VectorType *VTy = dyn_cast<VectorType>(Ty)) {
944 case IITDescriptor::PtrToArgument: {
945 Type *Ty = Tys[D.getArgumentNumber()];
948 case IITDescriptor::PtrToElt: {
949 Type *Ty = Tys[D.getArgumentNumber()];
956 case IITDescriptor::VecOfAnyPtrsToElt:
958 return Tys[D.getOverloadArgNumber()];
972 while (!TableRef.
empty())
985 #define GET_INTRINSIC_OVERLOAD_TABLE 986 #include "llvm/IR/IntrinsicImpl.inc" 987 #undef GET_INTRINSIC_OVERLOAD_TABLE 995 case Intrinsic::experimental_gc_statepoint:
996 case Intrinsic::experimental_patchpoint_void:
997 case Intrinsic::experimental_patchpoint_i64:
1003 #define GET_INTRINSIC_ATTRIBUTES 1004 #include "llvm/IR/IntrinsicImpl.inc" 1005 #undef GET_INTRINSIC_ATTRIBUTES 1016 #define GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN 1017 #include "llvm/IR/IntrinsicImpl.inc" 1018 #undef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN 1021 #define GET_LLVM_INTRINSIC_FOR_MS_BUILTIN 1022 #include "llvm/IR/IntrinsicImpl.inc" 1023 #undef GET_LLVM_INTRINSIC_FOR_MS_BUILTIN 1027 using namespace Intrinsic;
1030 if (Infos.
empty())
return true;
1032 Infos = Infos.
slice(1);
1035 case IITDescriptor::Void:
return !Ty->
isVoidTy();
1036 case IITDescriptor::VarArg:
return true;
1037 case IITDescriptor::MMX:
return !Ty->
isX86_MMXTy();
1038 case IITDescriptor::Token:
return !Ty->
isTokenTy();
1040 case IITDescriptor::Half:
return !Ty->
isHalfTy();
1041 case IITDescriptor::Float:
return !Ty->
isFloatTy();
1042 case IITDescriptor::Double:
return !Ty->
isDoubleTy();
1043 case IITDescriptor::Quad:
return !Ty->
isFP128Ty();
1045 case IITDescriptor::Vector: {
1050 case IITDescriptor::Pointer: {
1056 case IITDescriptor::Struct: {
1067 case IITDescriptor::Argument:
1079 case IITDescriptor::AK_Any:
return false;
1082 case IITDescriptor::AK_AnyVector:
return !isa<VectorType>(Ty);
1083 case IITDescriptor::AK_AnyPointer:
return !isa<PointerType>(Ty);
1087 case IITDescriptor::ExtendArgument: {
1093 if (
VectorType *VTy = dyn_cast<VectorType>(NewTy))
1095 else if (
IntegerType *ITy = dyn_cast<IntegerType>(NewTy))
1102 case IITDescriptor::TruncArgument: {
1108 if (
VectorType *VTy = dyn_cast<VectorType>(NewTy))
1110 else if (
IntegerType *ITy = dyn_cast<IntegerType>(NewTy))
1117 case IITDescriptor::HalfVecArgument:
1123 case IITDescriptor::SameVecWidthArgument: {
1129 if (!ThisArgType || !ReferenceType ||
1131 ThisArgType->getVectorNumElements()))
1136 case IITDescriptor::PtrToArgument: {
1141 return (!ThisArgType || ThisArgType->
getElementType() != ReferenceType);
1143 case IITDescriptor::PtrToElt: {
1150 return (!ThisArgType || !ReferenceType ||
1153 case IITDescriptor::VecOfAnyPtrsToElt: {
1157 if (RefArgNumber >= ArgTys.
size())
1162 "Table consistency error");
1170 if (!ThisArgVecTy || !ReferenceType ||
1172 ThisArgVecTy->getVectorNumElements()))
1193 if (Infos.
size() != 1)
1198 Infos = Infos.
slice(1);
1199 if (D.
Kind == IITDescriptor::VarArg)
1222 for (
auto Ty : FTy->
params())
1235 assert(NewDecl->getFunctionType() == FTy &&
"Shouldn't change the signature");
1243 const User *FU = U.getUser();
1244 if (isa<BlockAddress>(FU))
1246 if (!isa<CallInst>(FU) && !isa<InvokeInst>(FU)) {
1263 if (!hasLinkOnceLinkage() && !hasLocalLinkage() &&
1264 !hasAvailableExternallyLinkage())
1269 if (!isa<BlockAddress>(U))
1281 if (CS && CS.
hasFnAttr(Attribute::ReturnsTwice))
1289 assert(hasPersonalityFn() && getNumOperands());
1290 return cast<Constant>(Op<0>());
1294 setHungoffOperand<0>(Fn);
1295 setValueSubclassDataBit(3, Fn !=
nullptr);
1299 assert(hasPrefixData() && getNumOperands());
1300 return cast<Constant>(Op<1>());
1304 setHungoffOperand<1>(PrefixData);
1305 setValueSubclassDataBit(1, PrefixData !=
nullptr);
1309 assert(hasPrologueData() && getNumOperands());
1310 return cast<Constant>(Op<2>());
1314 setHungoffOperand<2>(PrologueData);
1315 setValueSubclassDataBit(2, PrologueData !=
nullptr);
1318 void Function::allocHungoffUselist() {
1320 if (getNumOperands())
1323 allocHungoffUses(3,
false);
1324 setNumHungOffUseOperands(3);
1334 void Function::setHungoffOperand(
Constant *
C) {
1336 allocHungoffUselist();
1338 }
else if (getNumOperands()) {
1344 void Function::setValueSubclassDataBit(
unsigned Bit,
bool On) {
1345 assert(Bit < 16 &&
"SubclassData contains only 16 bits");
1355 #if !defined(NDEBUG) 1356 auto PrevCount = getEntryCount();
1357 assert(!PrevCount.hasValue() || PrevCount.getType() == Count.
getType());
1374 if (MDS->getString().equals(
"function_entry_count")) {
1379 if (Count == (uint64_t)-1)
1382 }
else if (MDS->getString().equals(
"synthetic_function_entry_count")) {
1394 if (
MDString *MDS = dyn_cast<MDString>(MD->getOperand(0)))
1395 if (MDS->getString().equals(
"function_entry_count"))
1396 for (
unsigned i = 2; i < MD->getNumOperands(); i++)
1397 R.
insert(mdconst::extract<ConstantInt>(MD->getOperand(i))
1411 assert(cast<MDString>(MD->getOperand(0))
1413 .equals(
"function_section_prefix") &&
1414 "Metadata not match");
1415 return cast<MDString>(MD->getOperand(1))->getString();
1421 return getFnAttribute(
"null-pointer-is-valid")
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
const T & front() const
front - Get the first element.
bool hasNestAttr() const
Return true if this argument has the nest attribute.
Type * getVectorElementType() const
unsigned short getSubclassDataFromValue() const
void push_back(const T &Elt)
unsigned getInstructionCount()
Returns the number of non-debug IR instructions in this function.
iterator_range< use_iterator > uses()
bool hasAttribute(Attribute::AttrKind Kind) const
Check if an argument has a given attribute.
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
static Type * getDoubleTy(LLVMContext &C)
uint64_t getZExtValue() const
Get zero extended value.
This class represents an incoming formal argument to a Function.
uint64_t getDereferenceableOrNullBytes() const
If this argument has the dereferenceable_or_null attribute, return the number of bytes known to be de...
ArgKind getArgumentKind() const
void dropAllReferences()
Drop all references to operands.
uint64_t getParamDereferenceableBytes(unsigned ArgNo) const
Extract the number of dereferenceable bytes for a parameter.
bool isMetadataTy() const
Return true if this is 'metadata'.
Compute iterated dominance frontiers using a linear time algorithm.
Type * getElementType(unsigned N) const
void removeAttr(Attribute::AttrKind Kind)
Remove attributes from an argument.
Argument(Type *Ty, const Twine &Name="", Function *F=nullptr, unsigned ArgNo=0)
Argument constructor.
Constant * getOrInsertFunction(StringRef Name, FunctionType *T, AttributeList AttributeList)
Look up the specified function in the module symbol table.
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
adds the attribute to the list of attributes for the given arg.
A Module instance is used to store all the information related to an LLVM module. ...
2: 32-bit floating point type
const std::string & getGC(const Function &Fn)
Return the GC for a function.
void addDereferenceableAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable attribute to the list of attributes.
Implements a dense probed hash-table based set.
unsigned getNumElements() const
Random access to the elements.
unsigned getParamAlignment(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
bool hasByValOrInAllocaAttr() const
Return true if this argument has the byval attribute or inalloca attribute.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
bool isFP128Ty() const
Return true if this is 'fp128'.
void setGC(const Function &Fn, std::string GCName)
Define the GC for a function.
void setGC(std::string Str)
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space...
The two locations do not alias at all.
void addAttrs(AttrBuilder &B)
Add attributes to an argument.
bool isOverloaded(ID id)
Returns true if the intrinsic can be overloaded.
LLVMContext & getContext() const
All values hold a context through their type.
static MutableArrayRef< Argument > makeArgArray(Argument *Args, size_t Count)
bool hasPrologueData() const
Check whether this function has prologue data.
void setSectionPrefix(StringRef Prefix)
Set the section prefix for this function.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
4: 80-bit floating point type (X87)
This is a type descriptor which explains the type requirements of an intrinsic.
static bool isValidReturnType(Type *RetTy)
Return true if the specified type is valid as a return type.
const MDOperand & getOperand(unsigned I) const
1: 16-bit floating point type
static Type * getMetadataTy(LLVMContext &C)
This defines the Use class.
static VectorType * getTruncatedElementVectorType(VectorType *VTy)
This static method is like getInteger except that the element types are half as wide as the elements ...
static Type * getX86_MMXTy(LLVMContext &C)
bool hasByValAttr() const
Return true if this argument has the byval attribute.
void removeFromParent()
removeFromParent - This method unlinks 'this' from the containing module, but does not delete it...
DenseSet< GlobalValue::GUID > getImportGUIDs() const
Returns the set of GUIDs that needs to be imported to the function for sample PGO, to enable the same inlines as the profiled optimized binary.
Constant * getPrologueData() const
Get the prologue data associated with this function.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
AttributeList addDereferenceableParamAttr(LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given arg index.
bool hasPrefixData() const
Check whether this function has prefix data.
static Type * getTokenTy(LLVMContext &C)
inst_iterator inst_begin(Function *F)
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
ProfileCount getEntryCount() const
Get the entry count for this function.
AttributeList addDereferenceableOrNullParamAttr(LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const
Add the dereferenceable_or_null attribute to the attribute set at the given arg index.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
void setEntryCount(ProfileCount Count, const DenseSet< GlobalValue::GUID > *Imports=nullptr)
Set the entry count for this function.
static Type * getFloatTy(LLVMContext &C)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
TypeID getTypeID() const
Return the type id for the type.
AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Add an argument attribute to the list.
Class to represent struct types.
LLVMContext & getContext() const
Get the global data context.
A Use represents the edge between a Value definition and its users.
void deleteGC(const Function &Fn)
Remove the GC for a function.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
bool isIntegerTy() const
True if this is an instance of IntegerType.
This file contains the simple types necessary to represent the attributes associated with functions a...
bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
check if an attributes is in the list of attributes.
void setName(const Twine &Name)
Change the name of the value.
uint64_t getNumElements() const
unsigned getArgumentNumber() const
static StructType * get(LLVMContext &Context, ArrayRef< Type *> Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
Constant * getPrefixData() const
Get the prefix data associated with this function.
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
llvm::Optional< Function * > remangleIntrinsicFunction(Function *F)
Class to represent function types.
IIT_Info
IIT_Info - These are enumerators that describe the entries returned by the getIntrinsicInfoTableEntri...
Type * getType() const
All values are typed, get the type of this value.
AttributeList removeAttributes(LLVMContext &C, unsigned Index, const AttrBuilder &AttrsToRemove) const
Remove the specified attributes at the specified index from this attribute list.
bool onlyReadsMemory() const
Return true if this argument has the readonly or readnone attribute.
unsigned Struct_NumElements
Class to represent array types.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
const APInt & getValue() const
Return the constant as an APInt value reference.
auto lower_bound(R &&Range, ForwardIt I) -> decltype(adl_begin(Range))
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
const std::string & getGC() const
void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable_or_null attribute to the list of attributes.
AttributeList getAttributes() const
Return the attribute list for this Function.
bool hasPersonalityFn() const
Check whether this function has a personality function.
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
static Type * DecodeFixedType(ArrayRef< Intrinsic::IITDescriptor > &Infos, ArrayRef< Type *> Tys, LLVMContext &Context)
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const
Extract the number of dereferenceable_or_null bytes for a parameter.
Function * getDeclaration(Module *M, ID id, ArrayRef< Type *> Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
Class to represent pointers.
bool hasNoAliasAttr() const
Return true if this argument has the noalias attribute.
11: Arbitrary bit width integers
static std::string getMangledTypeStr(Type *Ty)
Returns a stable mangling for the type specified for use in the name mangling scheme used by 'any' ty...
bool isVoidTy() const
Return true if this is 'void'.
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
void setCallingConv(CallingConv::ID CC)
void addParamAttrs(unsigned ArgNo, const AttrBuilder &Attrs)
adds the attributes to the list of attributes for the given arg.
void addAttr(Attribute::AttrKind Kind)
static VectorType * getHalfElementsVectorType(VectorType *VTy)
This static method returns a VectorType with half as many elements as the input type and the same ele...
void stealArgumentListFrom(Function &Src)
Steal arguments from another function.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
AttributeList addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable_or_null attribute to the attribute set at the given index.
static ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
bool isLeaf(ID id)
Returns true if the intrinsic is a leaf, i.e.
static Intrinsic::ID lookupIntrinsicID(StringRef Name)
This does the actual lookup of an intrinsic ID which matches the given function name.
uint64_t getCount() const
const FunctionListType & getFunctionList() const
Get the Module's list of functions (constant).
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
bool hasNonNullAttr() const
Return true if this argument has the nonnull attribute.
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
bool hasStructRetAttr() const
Return true if this argument has the sret attribute.
unsigned Pointer_AddressSpace
void copyAttributesFrom(const Function *Src)
copyAttributesFrom - copy all additional attributes (those not needed to create a Function) from the ...
bool hasFnAttr(Attribute::AttrKind Kind) const
Return true if this function has the given attribute.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool hasSExtAttr() const
Return true if this argument has the sext attribute.
std::pair< iterator, bool > insert(const ValueT &V)
void removeAttribute(unsigned i, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
AMDGPU Lower Kernel Arguments
ArrayRef< Type * > params() const
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
static Type * getVoidTy(LLVMContext &C)
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
6: 128-bit floating point type (two 64-bits, PowerPC)
static FunctionType * get(Type *Result, ArrayRef< Type *> Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
bool hasReturnedAttr() const
Return true if this argument has the returned attribute.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
void recalculateIntrinsicID()
Recalculate the ID for this function if it is an Intrinsic defined in llvm/Intrinsics.h.
bool isX86_MMXTy() const
Return true if this is X86 MMX.
Optional< StringRef > getSectionPrefix() const
Get the section prefix for this function.
Class to represent integer types.
void removeParamAttrs(unsigned ArgNo, const AttrBuilder &Attrs)
removes the attribute from the list of attributes.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
bool hasInAllocaAttr() const
Return true if this argument has the inalloca attribute.
Class to represent profile counts.
static ArrayRef< const char * > findTargetSubtable(StringRef Name)
Find the segment of IntrinsicNameTable for intrinsics with the same target as Name, or the generic table if Name is not target specific.
C setMetadata(LLVMContext::MD_range, MDNode::get(Context, LowAndHigh))
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static Type * getFP128Ty(LLVMContext &C)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
static Type * getHalfTy(LLVMContext &C)
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
unsigned getOverloadArgNumber() const
bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
Equivalent to hasAttribute(ArgNo + FirstArgIndex, Kind).
static PointerType * getInt1PtrTy(LLVMContext &C, unsigned AS=0)
enum llvm::Intrinsic::IITDescriptor::IITDescriptorKind Kind
bool matchIntrinsicVarArg(bool isVarArg, ArrayRef< IITDescriptor > &Infos)
Verify if the intrinsic has variable arguments.
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the generic address space (address sp...
This is the shared class of boolean and integer constants.
void getIntrinsicInfoTableEntries(ID id, SmallVectorImpl< IITDescriptor > &T)
Return the IIT table descriptor for the specified intrinsic into an array of IITDescriptors.
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
unsigned getParamAlignment() const
If this is a byval or inalloca argument, return its alignment.
Module.h This file contains the declarations for the Module class.
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type *> Tys=None)
Return the function type for an intrinsic.
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
bool hasSwiftSelfAttr() const
Return true if this argument has the swiftself attribute.
Type * getReturnType() const
AttributeList addParamAttributes(LLVMContext &C, unsigned ArgNo, const AttrBuilder &B) const
Add an argument attribute to the list.
void dropAllReferences()
dropAllReferences() - This method causes all the subinstructions to "let go" of all references that t...
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static ProfileCount getInvalid()
std::string utostr(uint64_t X, bool isNeg=false)
bool NullPointerIsDefined(const Function *F, unsigned AS=0)
Check whether null pointer dereferencing is considered undefined behavior for a given function or an ...
void setValueSubclassData(unsigned short D)
void setAttributes(AttributeList Attrs)
Set the attribute list for this Function.
static VectorType * getExtendedElementVectorType(VectorType *VTy)
This static method is like getInteger except that the element types are twice as wide as the elements...
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
unsigned getVectorNumElements() const
FunctionType * getFunctionType() const
Returns the FunctionType for me.
Class to represent vector types.
Target - Wrapper for Target specific information.
AttributeList removeParamAttributes(LLVMContext &C, unsigned ArgNo, const AttrBuilder &AttrsToRemove) const
Remove the specified attribute at the specified arg index from this attribute list.
void push_back(pointer val)
LinkageTypes
An enumeration for the kinds of linkage for global values.
unsigned getArgNo() const
Return the index of this formal argument in its containing function.
iterator_range< user_iterator > users()
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...
static void DecodeIITType(unsigned &NextElt, ArrayRef< unsigned char > Infos, SmallVectorImpl< Intrinsic::IITDescriptor > &OutputTable)
Function::ProfileCount ProfileCount
void removeAttributes(unsigned i, const AttrBuilder &Attrs)
removes the attributes from the list of attributes.
AttributeList addAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
bool hasGC() const
hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generatio...
const Function * getParent() const
AttributeList addDereferenceableAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
unsigned getRefArgNumber() const
LLVM_NODISCARD bool empty() const
bool isTokenTy() const
Return true if this is 'token'.
StringRef getName() const
Return a constant reference to the value's name.
Establish a view to a call site for examination.
AttributeList removeAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
bool matchIntrinsicType(Type *Ty, ArrayRef< IITDescriptor > &Infos, SmallVectorImpl< Type *> &ArgTys)
Match the specified type (which comes from an intrinsic argument or return value) with the type const...
bool hasSwiftErrorAttr() const
Return true if this argument has the swifterror attribute.
void setPrologueData(Constant *PrologueData)
Compile-time customization of User operands.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
void eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing module and deletes it...
AttributeList addAttributes(LLVMContext &C, unsigned Index, const AttrBuilder &B) const
Add attributes to the attribute set at the given index.
bool callsFunctionThatReturnsTwice() const
callsFunctionThatReturnsTwice - Return true if the function has a call to setjmp or other function th...
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
3: 64-bit floating point type
bool hasAddressTaken(const User **=nullptr) const
hasAddressTaken - returns true if there are any uses of this function other than direct calls or invo...
void addAttributes(unsigned i, const AttrBuilder &Attrs)
adds the attributes to the list of attributes.
void addDereferenceableOrNullParamAttr(unsigned ArgNo, uint64_t Bytes)
adds the dereferenceable_or_null attribute to the list of attributes for the given arg...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
Constant * getPersonalityFn() const
Get the personality function associated with this function.
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
ProfileCountType getType() const
bool hasZExtAttr() const
Return true if this argument has the zext attribute.
static const char *const IntrinsicNameTable[]
Table of string intrinsic names indexed by enum value.
Type * getElementType() const
MDNode * createFunctionSectionPrefix(StringRef Prefix)
Return metadata containing the section prefix for a function.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
StringRef - Represent a constant reference to a string, i.e.
inst_iterator inst_end(Function *F)
int lookupLLVMIntrinsicByName(ArrayRef< const char *> NameTable, StringRef Name)
Looks up Name in NameTable via binary search.
void setPersonalityFn(Constant *Fn)
bool nullPointerIsDefined() const
Check if null pointer dereferencing is considered undefined behavior for the function.
9: MMX vectors (64 bits, X86 specific)
AttributeList removeParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified arg index from this attribute list.
bool hasNoCaptureAttr() const
Return true if this argument has the nocapture attribute.
void addDereferenceableParamAttr(unsigned ArgNo, uint64_t Bytes)
adds the dereferenceable attribute to the list of attributes for the given arg.
void copyAttributesFrom(const GlobalObject *Src)
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
bool isDefTriviallyDead() const
isDefTriviallyDead - Return true if it is trivially safe to remove this function definition from the ...
uint64_t getDereferenceableBytes() const
If this argument has the dereferenceable attribute, return the number of bytes known to be dereferenc...
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
bool hasLazyArguments() const
hasLazyArguments/CheckLazyArguments - The argument list of a function is built on demand...
Type * getElementType() const
void dropAllReferences()
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining...
std::vector< uint32_t > Metadata
PAL metadata represented as a vector.
bool empty() const
empty - Check if the array is empty.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...
5: 128-bit floating point type (112-bit mantissa)
void setPrefixData(Constant *PrefixData)
bool isCallee(Value::const_user_iterator UI) const
Determine whether the passed iterator points to the callee operand's Use.