70 :
Value(Ty,
Value::ArgumentVal), Parent(Par), ArgNo(ArgNo) {
74 void Argument::setParent(
Function *parent) {
79 if (!
getType()->isPointerTy())
return false;
83 getType()->getPointerAddressSpace() == 0)
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;
214 NumArgs(Ty->getNumParams()) {
216 "invalid return type");
221 SymTab = make_unique<ValueSymbolTable>();
225 setValueSubclassData(1);
249 void Function::BuildLazyArguments()
const {
253 Arguments = std::allocator<Argument>().allocate(NumArgs);
254 for (
unsigned i = 0, e = NumArgs; i != e; ++i) {
255 Type *ArgTy = FT->getParamType(i);
256 assert(!ArgTy->
isVoidTy() &&
"Cannot have void typed arguments!");
257 new (Arguments + i)
Argument(ArgTy,
"", const_cast<Function *>(
this), i);
263 const_cast<Function*
>(
this)->setValueSubclassData(SDC &= ~(1<<0));
271 void Function::clearArguments() {
276 std::allocator<Argument>().deallocate(Arguments, NumArgs);
287 "Expected arguments to be unused in declaration");
298 Arguments = Src.Arguments;
299 Src.Arguments =
nullptr;
333 while (!BasicBlocks.empty())
334 BasicBlocks.begin()->eraseFromParent();
450 setValueSubclassDataBit(14, !Str.empty());
458 setValueSubclassDataBit(14,
false);
482 #define GET_INTRINSIC_NAME_TABLE
483 #include "llvm/IR/Intrinsics.gen"
484 #undef GET_INTRINSIC_NAME_TABLE
488 #define GET_INTRINSIC_TARGET_DATA
489 #include "llvm/IR/Intrinsics.gen"
490 #undef GET_INTRINSIC_TARGET_DATA
503 auto It = std::lower_bound(Targets.begin(), Targets.end(),
Target,
504 [](
const IntrinsicTargetInfo &TI,
508 const auto &TI = It != Targets.end() && It->Name == Target ? *It : Targets[0];
527 bool IsPrefixMatch = Name.
size() > strlen(NameTable[Idx]);
558 if (
PointerType* PTyp = dyn_cast<PointerType>(Ty)) {
559 Result +=
"p" +
utostr(PTyp->getAddressSpace()) +
561 }
else if (
ArrayType* ATyp = dyn_cast<ArrayType>(Ty)) {
562 Result +=
"a" +
utostr(ATyp->getNumElements()) +
564 }
else if (
StructType *STyp = dyn_cast<StructType>(Ty)) {
565 if (!STyp->isLiteral()) {
567 Result += STyp->getName();
570 for (
auto Elem : STyp->elements())
575 }
else if (
FunctionType *FT = dyn_cast<FunctionType>(Ty)) {
577 for (
size_t i = 0; i < FT->getNumParams(); i++)
583 }
else if (isa<VectorType>(Ty))
594 "This version of getName does not support overloading");
601 for (
Type *Ty : Tys) {
657 using namespace Intrinsic;
660 unsigned StructElts = 2;
752 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
757 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
763 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
769 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
775 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
781 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
787 unsigned ArgInfo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
792 unsigned short ArgNo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
793 unsigned short RefNo = (NextElt == Infos.
size() ? 0 : Infos[NextElt++]);
807 for (
unsigned i = 0; i != StructElts; ++i)
815 #define GET_INTRINSIC_GENERATOR_GLOBAL
816 #include "llvm/IR/Intrinsics.gen"
817 #undef GET_INTRINSIC_GENERATOR_GLOBAL
822 unsigned TableVal = IIT_Table[
id-1];
827 unsigned NextElt = 0;
828 if ((TableVal >> 31) != 0) {
830 IITEntries = IIT_LongEncodingTable;
833 NextElt = (TableVal << 1) >> 1;
842 IITEntries = IITValues;
848 while (NextElt != IITEntries.
size() && IITEntries[NextElt] != 0)
854 using namespace Intrinsic;
856 IITDescriptor
D = Infos.
front();
857 Infos = Infos.
slice(1);
875 D.Pointer_AddressSpace);
878 assert(
D.Struct_NumElements <= 5 &&
"Can't handle this yet");
879 for (
unsigned i = 0, e =
D.Struct_NumElements; i != e; ++i)
884 return Tys[
D.getArgumentNumber()];
886 Type *Ty = Tys[
D.getArgumentNumber()];
887 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
893 Type *Ty = Tys[
D.getArgumentNumber()];
894 if (
VectorType *VTy = dyn_cast<VectorType>(Ty))
903 Tys[
D.getArgumentNumber()]));
906 Type *Ty = Tys[
D.getArgumentNumber()];
907 if (
VectorType *VTy = dyn_cast<VectorType>(Ty)) {
913 Type *Ty = Tys[
D.getArgumentNumber()];
917 Type *Ty = Tys[
D.getArgumentNumber()];
926 return Tys[
D.getOverloadArgNumber()];
940 while (!TableRef.
empty())
953 #define GET_INTRINSIC_OVERLOAD_TABLE
954 #include "llvm/IR/Intrinsics.gen"
955 #undef GET_INTRINSIC_OVERLOAD_TABLE
963 case Intrinsic::experimental_gc_statepoint:
964 case Intrinsic::experimental_patchpoint_void:
965 case Intrinsic::experimental_patchpoint_i64:
971 #define GET_INTRINSIC_ATTRIBUTES
972 #include "llvm/IR/Intrinsics.gen"
973 #undef GET_INTRINSIC_ATTRIBUTES
984 #define GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
985 #include "llvm/IR/Intrinsics.gen"
986 #undef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
989 #define GET_LLVM_INTRINSIC_FOR_MS_BUILTIN
990 #include "llvm/IR/Intrinsics.gen"
991 #undef GET_LLVM_INTRINSIC_FOR_MS_BUILTIN
995 using namespace Intrinsic;
998 if (Infos.
empty())
return true;
1000 Infos = Infos.
slice(1);
1028 for (
unsigned i = 0, e =
D.Struct_NumElements; i != e; ++i)
1037 if (
D.getArgumentNumber() < ArgTys.
size())
1038 return Ty != ArgTys[
D.getArgumentNumber()];
1042 assert(
D.getArgumentNumber() == ArgTys.
size() &&
"Table consistency error");
1045 switch (
D.getArgumentKind()) {
1056 if (
D.getArgumentNumber() >= ArgTys.
size())
1059 Type *NewTy = ArgTys[
D.getArgumentNumber()];
1060 if (
VectorType *VTy = dyn_cast<VectorType>(NewTy))
1062 else if (
IntegerType *ITy = dyn_cast<IntegerType>(NewTy))
1071 if (
D.getArgumentNumber() >= ArgTys.
size())
1074 Type *NewTy = ArgTys[
D.getArgumentNumber()];
1075 if (
VectorType *VTy = dyn_cast<VectorType>(NewTy))
1077 else if (
IntegerType *ITy = dyn_cast<IntegerType>(NewTy))
1086 return D.getArgumentNumber() >= ArgTys.
size() ||
1087 !isa<VectorType>(ArgTys[
D.getArgumentNumber()]) ||
1089 cast<VectorType>(ArgTys[
D.getArgumentNumber()])) != Ty;
1091 if (
D.getArgumentNumber() >= ArgTys.
size())
1096 if (!ThisArgType || !ReferenceType ||
1098 ThisArgType->getVectorNumElements()))
1104 if (
D.getArgumentNumber() >= ArgTys.
size())
1106 Type * ReferenceType = ArgTys[
D.getArgumentNumber()];
1108 return (!ThisArgType || ThisArgType->
getElementType() != ReferenceType);
1111 if (
D.getArgumentNumber() >= ArgTys.
size())
1117 return (!ThisArgType || !ReferenceType ||
1121 unsigned RefArgNumber =
D.getRefArgNumber();
1124 if (RefArgNumber >= ArgTys.
size())
1128 assert(
D.getOverloadArgNumber() == ArgTys.
size() &&
1129 "Table consistency error");
1137 if (!ThisArgVecTy || !ReferenceType ||
1139 ThisArgVecTy->getVectorNumElements()))
1160 if (Infos.
size() != 1)
1165 Infos = Infos.
slice(1);
1166 if (D.
Kind == IITDescriptor::VarArg)
1189 for (
auto Ty : FTy->
params())
1202 assert(NewDecl->getFunctionType() == FTy &&
"Shouldn't change the signature");
1210 const User *FU = U.getUser();
1211 if (isa<BlockAddress>(FU))
1213 if (!isa<CallInst>(FU) && !isa<InvokeInst>(FU)) {
1236 if (!isa<BlockAddress>(U))
1248 if (CS && CS.
hasFnAttr(Attribute::ReturnsTwice))
1257 return cast<Constant>(Op<0>());
1261 setHungoffOperand<0>(Fn);
1262 setValueSubclassDataBit(3, Fn !=
nullptr);
1267 return cast<Constant>(Op<1>());
1271 setHungoffOperand<1>(PrefixData);
1272 setValueSubclassDataBit(1, PrefixData !=
nullptr);
1277 return cast<Constant>(Op<2>());
1281 setHungoffOperand<2>(PrologueData);
1282 setValueSubclassDataBit(2, PrologueData !=
nullptr);
1285 void Function::allocHungoffUselist() {
1301 void Function::setHungoffOperand(
Constant *
C) {
1303 allocHungoffUselist();
1311 void Function::setValueSubclassDataBit(
unsigned Bit,
bool On) {
1312 assert(Bit < 16 &&
"SubclassData contains only 16 bits");
1329 if (MDS->getString().equals(
"function_entry_count")) {
1342 if (
MDString *MDS = dyn_cast<MDString>(MD->getOperand(0)))
1343 if (MDS->getString().equals(
"function_entry_count"))
1344 for (
unsigned i = 2; i < MD->getNumOperands(); i++)
1345 R.
insert(mdconst::extract<ConstantInt>(MD->getOperand(i))
1359 assert(dyn_cast<MDString>(MD->getOperand(0))
1361 .equals(
"function_section_prefix") &&
1362 "Metadata not match");
bool hasNoCaptureAttr() const
Return true if this argument has the nocapture attribute.
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
bool hasNoAliasAttr() const
Return true if this argument has the noalias attribute.
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.
bool isDefTriviallyDead() const
isDefTriviallyDead - Return true if it is trivially safe to remove this function definition from the ...
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 hasLazyArguments() const
hasLazyArguments/CheckLazyArguments - The argument list of a function is built on demand...
void push_back(const T &Elt)
uint64_t getParamDereferenceableBytes(unsigned ArgNo) const
Extract the number of dereferenceable bytes for a parameter.
iterator_range< use_iterator > uses()
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
static Type * getDoubleTy(LLVMContext &C)
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
This class represents an incoming formal argument to a Function.
Constant * getPrologueData() const
Get the prologue data associated with this function.
bool onlyReadsMemory() const
Return true if this argument has the readonly or readnone attribute.
uint64_t getZExtValue() const
Get zero extended value.
void dropAllReferences()
Drop all references to operands.
iterator erase(iterator where)
AttributeList removeParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified arg index from this attribute list.
void removeAttr(Attribute::AttrKind Kind)
Remove attributes from an argument.
unsigned getArgNo() const
Return the index of this formal argument in its containing function.
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. ...
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
AttributeList removeParamAttributes(LLVMContext &C, unsigned ArgNo, const AttrBuilder &AttrsToRemove) const
Remove the specified attribute at the specified arg index from this attribute list.
const std::string & getGC(const Function &Fn)
Return the GC for a function.
MDNode * createFunctionEntryCount(uint64_t Count, const DenseSet< GlobalValue::GUID > *Imports)
Return metadata containing the entry Count for a function, and the GUIDs stored in Imports that need ...
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.
const T & front() const
front - Get the first element.
void addDereferenceableAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable attribute to the list of attributes.
bool hasByValOrInAllocaAttr() const
Return true if this argument has the byval attribute or inalloca attribute.
Implements a dense probed hash-table based set.
unsigned getNumOperands() const
void setGC(const Function &Fn, std::string GCName)
Define the GC for a function.
ArrayRef< Type * > params() const
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...
void addAttrs(AttrBuilder &B)
Add attributes to an argument.
AttributeList addParamAttributes(LLVMContext &C, unsigned ArgNo, const AttrBuilder &B) const
Add an argument attribute to the list.
bool hasSwiftSelfAttr() const
Return true if this argument has the swiftself attribute.
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
bool isOverloaded(ID id)
Returns true if the intrinsic can be overloaded.
bool hasAvailableExternallyLinkage() const
static MutableArrayRef< Argument > makeArgArray(Argument *Args, size_t Count)
AttributeList addDereferenceableParamAttr(LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given arg index.
void setSectionPrefix(StringRef Prefix)
Set the section prefix for this function.
bool isTokenTy() const
Return true if this is 'token'.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
bool hasPrologueData() const
Check whether this function has prologue data.
The two locations do not alias at all.
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.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
Return the function type for an intrinsic.
static Type * getMetadataTy(LLVMContext &C)
This defines the Use class.
Type * getElementType() const
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)
void removeFromParent()
removeFromParent - This method unlinks 'this' from the containing module, but does not delete it...
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
StringRef getName() const
Return a constant reference to the value's name.
AttributeList getAttributes() const
Return the attribute list for this Function.
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...
std::string getEVTString() const
This function returns value type as a string, e.g. "i32".
static Type * getTokenTy(LLVMContext &C)
inst_iterator inst_begin(Function *F)
bool hasGC() const
hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generatio...
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool hasSwiftErrorAttr() const
Return true if this argument has the swifterror attribute.
static Type * getFloatTy(LLVMContext &C)
const APInt & getValue() const
Return the constant as an APInt value reference.
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Class to represent struct types.
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...
Optional< StringRef > getSectionPrefix() const
Get the section prefix for this function.
Constant * getPersonalityFn() const
Get the personality function associated with this function.
static StringRef getName(Value *V)
This file contains the simple types necessary to represent the attributes associated with functions a...
AttributeList addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable_or_null attribute to the attribute set at the given index.
void setName(const Twine &Name)
Change the name of the value.
uint64_t getDereferenceableOrNullBytes() const
If this argument has the dereferenceable_or_null attribute, return the number of bytes known to be de...
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const
Extract the number of dereferenceable_or_null bytes for a parameter.
Type * getVectorElementType() const
uint64_t getDereferenceableBytes() const
If this argument has the dereferenceable attribute, return the number of bytes known to be dereferenc...
LLVM_NODISCARD bool empty() const
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
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...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
bool hasStructRetAttr() const
Return true if this argument has the sret attribute.
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
Equivalent to hasAttribute(ArgNo + FirstArgIndex, Kind).
Class to represent array types.
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.
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
static std::string utostr(uint64_t X, bool isNeg=false)
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes)
adds the dereferenceable_or_null attribute to the list of attributes.
bool hasNestAttr() const
Return true if this argument has the nest attribute.
Optional< uint64_t > getEntryCount() const
Get the entry count for this function.
AttributeList addAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
Type * getElementType() const
size_t size() const
size - Get the array size.
bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
check if an attributes is in the list of attributes.
void setIsMaterializable(bool V)
Class to represent pointers.
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...
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
bool isX86_MMXTy() const
Return true if this is X86 MMX.
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
void setCallingConv(CallingConv::ID CC)
void addParamAttrs(unsigned ArgNo, const AttrBuilder &Attrs)
adds the attributes to the list of attributes for the given arg.
Type * getReturnType() const
Returns the type of the ret val.
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 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.
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.
FunctionType * getFunctionType() const
Returns the FunctionType for me.
const Function * getParent() const
bool hasAttribute(Attribute::AttrKind Kind) const
Check if an argument has a given attribute.
Type * getElementType(unsigned N) const
This is an important base class in LLVM.
bool hasInAllocaAttr() const
Return true if this argument has the inalloca attribute.
void copyAttributesFrom(const Function *Src)
copyAttributesFrom - copy all additional attributes (those not needed to create a Function) from the ...
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
std::pair< iterator, bool > insert(const ValueT &V)
void removeAttribute(unsigned i, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
unsigned getParamAlignment(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
unsigned getParamAlignment() const
If this is a byval or inalloca argument, return its alignment.
bool hasPersonalityFn() const
Check whether this function has a personality function.
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
static Type * getVoidTy(LLVMContext &C)
bool hasSExtAttr() const
Return true if this argument has the sext attribute.
uint64_t getNumElements() const
bool hasFnAttr(Attribute::AttrKind Kind) const
Return true if this function has the given attribute.
static IITDescriptor get(IITDescriptorKind K, unsigned Field)
void recalculateIntrinsicID()
Recalculate the ID for this function if it is an Intrinsic defined in llvm/Intrinsics.h.
Intrinsic::ID IntID
The intrinsic ID for this subclass (which must be a Function).
self_iterator getIterator()
Class to represent integer types.
void removeParamAttrs(unsigned ArgNo, const AttrBuilder &Attrs)
removes the attribute from the list of attributes.
bool empty() const
empty - Check if the array is empty.
AttributeList removeAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
AttributeList addDereferenceableAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
AttributeList addAttributes(LLVMContext &C, unsigned Index, const AttrBuilder &B) const
Add attributes to the attribute set at the given index.
static wasm::ValType getType(const TargetRegisterClass *RC)
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
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.
bool hasByValAttr() const
Return true if this argument has the byval attribute.
const FunctionListType & getFunctionList() const
Get the Module's list of functions (constant).
void setEntryCount(uint64_t Count, const DenseSet< GlobalValue::GUID > *Imports=nullptr)
Set the entry count for this function.
static Type * getHalfTy(LLVMContext &C)
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
const MDOperand & getOperand(unsigned I) const
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.
static StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
void getIntrinsicInfoTableEntries(ID id, SmallVectorImpl< IITDescriptor > &T)
Return the IIT table descriptor for the specified intrinsic into an array of IITDescriptors.
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
void setGlobalObjectSubClassData(unsigned Val)
static const char * Target
void dropAllReferences()
dropAllReferences() - This method causes all the subinstructions to "let go" of all references that t...
bool hasZExtAttr() const
Return true if this argument has the zext attribute.
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...
Class to represent vector types.
Target - Wrapper for Target specific information.
AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Add an argument attribute to the list.
void push_back(pointer val)
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
bool isIntegerTy() const
True if this is an instance of IntegerType.
iterator_range< user_iterator > users()
unsigned HasLLVMReservedName
True if the function's name starts with "llvm.".
unsigned getVectorNumElements() const
bool hasNonNullAttr() const
Return true if this argument has the nonnull attribute.
static void DecodeIITType(unsigned &NextElt, ArrayRef< unsigned char > Infos, SmallVectorImpl< Intrinsic::IITDescriptor > &OutputTable)
MDNode * getMetadata(unsigned KindID) const
Get the current metadata attachments for the given kind, if any.
void setMetadata(unsigned KindID, MDNode *MD)
Set a particular kind of metadata attachment.
llvm_unreachable("Unknown RegBank!")
AttributeList removeAttributes(LLVMContext &C, unsigned Index, const AttrBuilder &AttrsToRemove) const
Remove the specified attributes at the specified index from this attribute list.
bool hasLinkOnceLinkage() const
void removeAttributes(unsigned i, const AttrBuilder &Attrs)
removes the attributes from the list of attributes.
pointer remove(iterator &IT)
PointerType * getType() const
Global values are always pointers.
bool hasAddressTaken(const User **=nullptr) const
hasAddressTaken - returns true if there are any uses of this function other than direct calls or invo...
unsigned short getSubclassDataFromValue() const
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
Establish a view to a call site for examination.
const std::string & getGC() const
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
bool callsFunctionThatReturnsTwice() const
callsFunctionThatReturnsTwice - Return true if the function has a call to setjmp or other function th...
void setPrologueData(Constant *PrologueData)
Compile-time customization of User operands.
bool hasPrefixData() const
Check whether this function has prefix data.
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...
Constant * getPrefixData() const
Get the prefix data associated with this function.
static EVT getEVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
bool hasLocalLinkage() const
int lookupLLVMIntrinsicByName(ArrayRef< const char * > NameTable, StringRef Name)
Looks up Name in NameTable via binary search.
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...
Type * getReturnType() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static Type * DecodeFixedType(ArrayRef< Intrinsic::IITDescriptor > &Infos, ArrayRef< Type * > Tys, LLVMContext &Context)
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
void allocHungoffUses(unsigned N, bool IsPhi=false)
Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
static const char *const IntrinsicNameTable[]
Table of string intrinsic names indexed by enum value.
MDNode * createFunctionSectionPrefix(StringRef Prefix)
Return metadata containing the section prefix for a function.
StringRef - Represent a constant reference to a string, i.e.
inst_iterator inst_end(Function *F)
void setPersonalityFn(Constant *Fn)
void setNumHungOffUseOperands(unsigned NumOps)
Subclasses with hung off uses need to manage the operand count themselves.
unsigned getNumElements() const
Random access to the elements.
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 hasReturnedAttr() const
Return true if this argument has the returned attribute.
void dropAllReferences()
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining...
LLVMContext & getContext() const
Get the global data context.
bool isCallee(Value::const_user_iterator UI) const
Determine whether the passed iterator points to the callee operand's Use.
bool isVoidTy() const
Return true if this is 'void'.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...
bool isMetadataTy() const
Return true if this is 'metadata'.
void setPrefixData(Constant *PrefixData)