66 "non-global-value-max-name-size", cl::Hidden, cl::init(1024),
67 cl::desc(
"Maximum size for the name of non-global values."));
69void Function::renumberBlocks() {
70 validateBlockNumbers();
73 for (
auto &BB : *
this)
74 BB.Number = NextBlockNum++;
78void Function::validateBlockNumbers()
const {
81 for (
const auto &BB : *
this) {
82 unsigned Num = BB.getNumber();
83 assert(Num < NextBlockNum &&
"out of range block number");
84 assert(!Numbers[Num] &&
"duplicate block numbers");
90void Function::convertToNewDbgValues() {
91 for (
auto &BB : *
this) {
92 BB.convertToNewDbgValues();
96void Function::convertFromNewDbgValues() {
97 for (
auto &BB : *
this) {
98 BB.convertFromNewDbgValues();
107 :
Value(Ty,
Value::ArgumentVal), Parent(Par), ArgNo(ArgNo) {
111void Argument::setParent(
Function *parent) {
115bool Argument::hasNonNullAttr(
bool AllowUndefOrPoison)
const {
117 if (
getParent()->hasParamAttribute(getArgNo(), Attribute::NonNull) &&
118 (AllowUndefOrPoison ||
119 getParent()->hasParamAttribute(getArgNo(), Attribute::NoUndef)))
121 else if (getDereferenceableBytes() > 0 &&
128bool Argument::hasByValAttr()
const {
130 return hasAttribute(Attribute::ByVal);
133bool Argument::hasDeadOnReturnAttr()
const {
136 return hasAttribute(Attribute::DeadOnReturn);
139bool Argument::hasByRefAttr()
const {
142 return hasAttribute(Attribute::ByRef);
145bool Argument::hasSwiftSelfAttr()
const {
146 return getParent()->hasParamAttribute(getArgNo(), Attribute::SwiftSelf);
149bool Argument::hasSwiftErrorAttr()
const {
150 return getParent()->hasParamAttribute(getArgNo(), Attribute::SwiftError);
153bool Argument::hasInAllocaAttr()
const {
155 return hasAttribute(Attribute::InAlloca);
158bool Argument::hasPreallocatedAttr()
const {
161 return hasAttribute(Attribute::Preallocated);
164bool Argument::hasPassPointeeByValueCopyAttr()
const {
167 return Attrs.hasParamAttr(getArgNo(), Attribute::ByVal) ||
168 Attrs.hasParamAttr(getArgNo(), Attribute::InAlloca) ||
169 Attrs.hasParamAttr(getArgNo(), Attribute::Preallocated);
172bool Argument::hasPointeeInMemoryValueAttr()
const {
176 return Attrs.hasParamAttr(getArgNo(), Attribute::ByVal) ||
177 Attrs.hasParamAttr(getArgNo(), Attribute::StructRet) ||
178 Attrs.hasParamAttr(getArgNo(), Attribute::InAlloca) ||
179 Attrs.hasParamAttr(getArgNo(), Attribute::Preallocated) ||
180 Attrs.hasParamAttr(getArgNo(), Attribute::ByRef);
204 getParent()->getAttributes().getParamAttrs(getArgNo());
206 return DL.getTypeAllocSize(MemTy);
210Type *Argument::getPointeeInMemoryValueType()
const {
212 getParent()->getAttributes().getParamAttrs(getArgNo());
218 return getParent()->getParamAlign(getArgNo());
221MaybeAlign Argument::getParamStackAlign()
const {
222 return getParent()->getParamStackAlign(getArgNo());
225Type *Argument::getParamByValType()
const {
227 return getParent()->getParamByValType(getArgNo());
230Type *Argument::getParamStructRetType()
const {
232 return getParent()->getParamStructRetType(getArgNo());
235Type *Argument::getParamByRefType()
const {
237 return getParent()->getParamByRefType(getArgNo());
240Type *Argument::getParamInAllocaType()
const {
242 return getParent()->getParamInAllocaType(getArgNo());
245uint64_t Argument::getDereferenceableBytes()
const {
247 "Only pointers have dereferenceable bytes");
248 return getParent()->getParamDereferenceableBytes(getArgNo());
251uint64_t Argument::getDereferenceableOrNullBytes()
const {
253 "Only pointers have dereferenceable bytes");
254 return getParent()->getParamDereferenceableOrNullBytes(getArgNo());
258 return getParent()->getParamNoFPClass(getArgNo());
261std::optional<ConstantRange> Argument::getRange()
const {
262 const Attribute RangeAttr = getAttribute(llvm::Attribute::Range);
268bool Argument::hasNestAttr()
const {
270 return hasAttribute(Attribute::Nest);
273bool Argument::hasNoAliasAttr()
const {
275 return hasAttribute(Attribute::NoAlias);
278bool Argument::hasNoCaptureAttr()
const {
283bool Argument::hasNoFreeAttr()
const {
285 return hasAttribute(Attribute::NoFree);
288bool Argument::hasStructRetAttr()
const {
290 return hasAttribute(Attribute::StructRet);
293bool Argument::hasInRegAttr()
const {
294 return hasAttribute(Attribute::InReg);
297bool Argument::hasReturnedAttr()
const {
298 return hasAttribute(Attribute::Returned);
301bool Argument::hasZExtAttr()
const {
302 return hasAttribute(Attribute::ZExt);
305bool Argument::hasSExtAttr()
const {
306 return hasAttribute(Attribute::SExt);
309bool Argument::onlyReadsMemory()
const {
311 return Attrs.hasParamAttr(getArgNo(), Attribute::ReadOnly) ||
312 Attrs.hasParamAttr(getArgNo(), Attribute::ReadNone);
317 AL =
AL.addParamAttributes(Parent->getContext(), getArgNo(),
B);
322 getParent()->addParamAttr(getArgNo(), Kind);
326 getParent()->addParamAttr(getArgNo(), Attr);
330 getParent()->removeParamAttr(getArgNo(), Kind);
335 AL =
AL.removeParamAttributes(Parent->getContext(), getArgNo(), AM);
340 return getParent()->hasParamAttribute(getArgNo(), Kind);
343bool Argument::hasAttribute(
StringRef Kind)
const {
344 return getParent()->hasParamAttribute(getArgNo(), Kind);
348 return getParent()->getParamAttribute(getArgNo(), Kind);
352 return getParent()->getAttributes().getParamAttrs(getArgNo());
360 return getType()->getContext();
363const DataLayout &Function::getDataLayout()
const {
367unsigned Function::getInstructionCount()
const {
368 unsigned NumInstrs = 0;
370 NumInstrs += std::distance(BB.instructionsWithoutDebug().begin(),
371 BB.instructionsWithoutDebug().end());
377 return Create(Ty,
Linkage,
M.getDataLayout().getProgramAddressSpace(),
N, &M);
382 unsigned AddrSpace,
const Twine &
N,
387 if (UWTable != UWTableKind::None)
388 B.addUWTableAttr(UWTable);
389 switch (
M->getFramePointer()) {
390 case FramePointerKind::None:
393 case FramePointerKind::Reserved:
394 B.addAttribute(
"frame-pointer",
"reserved");
396 case FramePointerKind::NonLeaf:
397 B.addAttribute(
"frame-pointer",
"non-leaf");
399 case FramePointerKind::All:
400 B.addAttribute(
"frame-pointer",
"all");
403 if (
M->getModuleFlag(
"function_return_thunk_extern"))
404 B.addAttribute(Attribute::FnRetThunkExtern);
405 StringRef DefaultCPU =
F->getContext().getDefaultTargetCPU();
406 if (!DefaultCPU.
empty())
407 B.addAttribute(
"target-cpu", DefaultCPU);
408 StringRef DefaultFeatures =
F->getContext().getDefaultTargetFeatures();
409 if (!DefaultFeatures.
empty())
410 B.addAttribute(
"target-features", DefaultFeatures);
413 auto isModuleAttributeSet = [&](
const StringRef &ModAttr) ->
bool {
415 mdconst::extract_or_null<ConstantInt>(
M->getModuleFlag(ModAttr));
416 return Attr && !Attr->isZero();
419 auto AddAttributeIfSet = [&](
const StringRef &ModAttr) {
420 if (isModuleAttributeSet(ModAttr))
421 B.addAttribute(ModAttr);
425 if (isModuleAttributeSet(
"sign-return-address"))
426 SignType =
"non-leaf";
427 if (isModuleAttributeSet(
"sign-return-address-all"))
429 if (SignType !=
"none") {
430 B.addAttribute(
"sign-return-address", SignType);
431 B.addAttribute(
"sign-return-address-key",
432 isModuleAttributeSet(
"sign-return-address-with-bkey")
436 AddAttributeIfSet(
"branch-target-enforcement");
437 AddAttributeIfSet(
"branch-protection-pauth-lr");
438 AddAttributeIfSet(
"guarded-control-stack");
444void Function::removeFromParent() {
445 getParent()->getFunctionList().remove(getIterator());
448void Function::eraseFromParent() {
449 getParent()->getFunctionList().erase(getIterator());
455#ifdef EXPENSIVE_CHECKS
457 auto FromFEnd = FromF->
end();
458 for (
auto It = FromBeginIt; It != FromEndIt; ++It)
459 assert(It != FromFEnd &&
"FromBeginIt not before FromEndIt!");
461 BasicBlocks.splice(ToIt, FromF->BasicBlocks, FromBeginIt, FromEndIt);
466 return BasicBlocks.erase(FromIt, ToIt);
476 if (AddrSpace ==
static_cast<unsigned>(-1))
477 return M ?
M->getDataLayout().getProgramAddressSpace() : 0;
485 NumArgs(Ty->getNumParams()) {
486 assert(FunctionType::isValidReturnType(getReturnType()) &&
487 "invalid return type");
488 setGlobalObjectSubClassData(0);
491 if (!getContext().shouldDiscardValueNames())
495 if (Ty->getNumParams())
496 setValueSubclassData(1);
502 HasLLVMReservedName =
getName().starts_with(
"llvm.");
510 if (!Intrinsic::getIntrinsicSignature(IntID, Ty, OverloadTys))
513 setAttributes(Intrinsic::getAttributes(getContext(), IntID, Ty));
517Function::~Function() {
518 validateBlockNumbers();
530void Function::BuildLazyArguments()
const {
532 auto *FT = getFunctionType();
534 Arguments = std::allocator<Argument>().allocate(NumArgs);
535 for (
unsigned i = 0, e = NumArgs; i !=
e; ++i) {
536 Type *ArgTy = FT->getParamType(i);
537 assert(!ArgTy->
isVoidTy() &&
"Cannot have void typed arguments!");
543 unsigned SDC = getSubclassDataFromValue();
545 const_cast<Function*
>(
this)->setValueSubclassData(SDC);
546 assert(!hasLazyArguments());
553bool Function::isConstrainedFPIntrinsic()
const {
557void Function::clearArguments() {
562 std::allocator<Argument>().deallocate(
Arguments, NumArgs);
566void Function::stealArgumentListFrom(
Function &Src) {
567 assert(isDeclaration() &&
"Expected no references to current arguments");
570 if (!hasLazyArguments()) {
572 [](
const Argument &
A) {
return A.use_empty(); }) &&
573 "Expected arguments to be unused in declaration");
575 setValueSubclassData(getSubclassDataFromValue() | (1 << 0));
579 if (Src.hasLazyArguments())
583 assert(arg_size() == Src.arg_size());
585 Src.Arguments =
nullptr;
598 setValueSubclassData(getSubclassDataFromValue() & ~(1 << 0));
599 assert(!hasLazyArguments());
600 Src.setValueSubclassData(Src.getSubclassDataFromValue() | (1 << 0));
603void Function::deleteBodyImpl(
bool ShouldDrop) {
604 setIsMaterializable(
false);
611 while (!BasicBlocks.empty())
612 BasicBlocks.begin()->eraseFromParent();
614 if (getNumOperands()) {
617 User::dropAllReferences();
618 setNumHungOffUseOperands(0);
621 auto *CPN = ConstantPointerNull::get(PointerType::get(getContext(), 0));
626 setValueSubclassData(getSubclassDataFromValue() & ~0xe);
633void Function::addAttributeAtIndex(
unsigned i,
Attribute Attr) {
634 AttributeSets = AttributeSets.addAttributeAtIndex(getContext(), i, Attr);
638 AttributeSets = AttributeSets.addFnAttribute(getContext(), Kind);
642 AttributeSets = AttributeSets.addFnAttribute(getContext(), Kind, Val);
645void Function::addFnAttr(
Attribute Attr) {
646 AttributeSets = AttributeSets.addFnAttribute(getContext(), Attr);
649void Function::addFnAttrs(
const AttrBuilder &Attrs) {
650 AttributeSets = AttributeSets.addFnAttributes(getContext(), Attrs);
654 AttributeSets = AttributeSets.addRetAttribute(getContext(), Kind);
657void Function::addRetAttr(
Attribute Attr) {
658 AttributeSets = AttributeSets.addRetAttribute(getContext(), Attr);
661void Function::addRetAttrs(
const AttrBuilder &Attrs) {
662 AttributeSets = AttributeSets.addRetAttributes(getContext(), Attrs);
666 AttributeSets = AttributeSets.addParamAttribute(getContext(), ArgNo, Kind);
669void Function::addParamAttr(
unsigned ArgNo,
Attribute Attr) {
670 AttributeSets = AttributeSets.addParamAttribute(getContext(), ArgNo, Attr);
673void Function::addParamAttrs(
unsigned ArgNo,
const AttrBuilder &Attrs) {
674 AttributeSets = AttributeSets.addParamAttributes(getContext(), ArgNo, Attrs);
678 AttributeSets = AttributeSets.removeAttributeAtIndex(getContext(), i, Kind);
681void Function::removeAttributeAtIndex(
unsigned i,
StringRef Kind) {
682 AttributeSets = AttributeSets.removeAttributeAtIndex(getContext(), i, Kind);
686 AttributeSets = AttributeSets.removeFnAttribute(getContext(), Kind);
689void Function::removeFnAttr(
StringRef Kind) {
690 AttributeSets = AttributeSets.removeFnAttribute(getContext(), Kind);
694 AttributeSets = AttributeSets.removeFnAttributes(getContext(), AM);
698 AttributeSets = AttributeSets.removeRetAttribute(getContext(), Kind);
701void Function::removeRetAttr(
StringRef Kind) {
702 AttributeSets = AttributeSets.removeRetAttribute(getContext(), Kind);
706 AttributeSets = AttributeSets.removeRetAttributes(getContext(), Attrs);
710 AttributeSets = AttributeSets.removeParamAttribute(getContext(), ArgNo, Kind);
713void Function::removeParamAttr(
unsigned ArgNo,
StringRef Kind) {
714 AttributeSets = AttributeSets.removeParamAttribute(getContext(), ArgNo, Kind);
717void Function::removeParamAttrs(
unsigned ArgNo,
const AttributeMask &Attrs) {
719 AttributeSets.removeParamAttributes(getContext(), ArgNo, Attrs);
722void Function::addDereferenceableParamAttr(
unsigned ArgNo,
uint64_t Bytes) {
724 AttributeSets.addDereferenceableParamAttr(getContext(), ArgNo, Bytes);
728 return AttributeSets.hasFnAttr(Kind);
731bool Function::hasFnAttribute(
StringRef Kind)
const {
732 return AttributeSets.hasFnAttr(Kind);
736 return AttributeSets.hasRetAttr(Kind);
739bool Function::hasParamAttribute(
unsigned ArgNo,
741 return AttributeSets.hasParamAttr(ArgNo, Kind);
744bool Function::hasParamAttribute(
unsigned ArgNo,
StringRef Kind)
const {
745 return AttributeSets.hasParamAttr(ArgNo, Kind);
748Attribute Function::getAttributeAtIndex(
unsigned i,
750 return AttributeSets.getAttributeAtIndex(i, Kind);
754 return AttributeSets.getAttributeAtIndex(i, Kind);
757bool Function::hasAttributeAtIndex(
unsigned Idx,
759 return AttributeSets.hasAttributeAtIndex(
Idx, Kind);
763 return AttributeSets.getFnAttr(Kind);
767 return AttributeSets.getFnAttr(Kind);
771 return AttributeSets.getRetAttr(Kind);
778 if (
A.isStringAttribute()) {
780 if (Str.getAsInteger(0, Result))
781 getContext().emitError(
"cannot parse integer attribute " +
Name);
788Attribute Function::getParamAttribute(
unsigned ArgNo,
790 return AttributeSets.getParamAttr(ArgNo, Kind);
793void Function::addDereferenceableOrNullParamAttr(
unsigned ArgNo,
795 AttributeSets = AttributeSets.addDereferenceableOrNullParamAttr(getContext(),
800 AttributeSets = AttributeSets.addRangeRetAttr(getContext(), CR);
804 if (&FPType == &APFloat::IEEEsingle()) {
812 return getDenormalModeRaw();
816 Attribute Attr = getFnAttribute(
"denormal-fp-math");
822 Attribute Attr = getFnAttribute(
"denormal-fp-math-f32");
828 return DenormalMode::getInvalid();
831const std::string &Function::getGC()
const {
832 assert(hasGC() &&
"Function has no collector");
833 return getContext().getGC(*
this);
836void Function::setGC(std::string Str) {
837 setValueSubclassDataBit(14, !Str.empty());
838 getContext().setGC(*
this, std::move(Str));
841void Function::clearGC() {
844 getContext().deleteGC(*
this);
845 setValueSubclassDataBit(14,
false);
848bool Function::hasStackProtectorFnAttr()
const {
849 return hasFnAttribute(Attribute::StackProtect) ||
850 hasFnAttribute(Attribute::StackProtectStrong) ||
851 hasFnAttribute(Attribute::StackProtectReq);
856void Function::copyAttributesFrom(
const Function *Src) {
857 GlobalObject::copyAttributesFrom(Src);
858 setCallingConv(Src->getCallingConv());
859 setAttributes(Src->getAttributes());
864 if (Src->hasPersonalityFn())
865 setPersonalityFn(Src->getPersonalityFn());
866 if (Src->hasPrefixData())
867 setPrefixData(Src->getPrefixData());
868 if (Src->hasPrologueData())
869 setPrologueData(Src->getPrologueData());
876 addFnAttr(Attribute::getWithMemoryEffects(getContext(), ME));
880bool Function::doesNotAccessMemory()
const {
881 return getMemoryEffects().doesNotAccessMemory();
883void Function::setDoesNotAccessMemory() {
888bool Function::onlyReadsMemory()
const {
889 return getMemoryEffects().onlyReadsMemory();
891void Function::setOnlyReadsMemory() {
896bool Function::onlyWritesMemory()
const {
897 return getMemoryEffects().onlyWritesMemory();
899void Function::setOnlyWritesMemory() {
905bool Function::onlyAccessesArgMemory()
const {
906 return getMemoryEffects().onlyAccessesArgPointees();
908void Function::setOnlyAccessesArgMemory() {
914bool Function::onlyAccessesInaccessibleMemory()
const {
915 return getMemoryEffects().onlyAccessesInaccessibleMem();
917void Function::setOnlyAccessesInaccessibleMemory() {
918 setMemoryEffects(getMemoryEffects() & MemoryEffects::inaccessibleMemOnly());
923bool Function::onlyAccessesInaccessibleMemOrArgMem()
const {
924 return getMemoryEffects().onlyAccessesInaccessibleOrArgMem();
926void Function::setOnlyAccessesInaccessibleMemOrArgMem() {
928 MemoryEffects::inaccessibleOrArgMemOnly());
931bool Function::isTargetIntrinsic()
const {
932 return Intrinsic::isTargetIntrinsic(IntID);
935void Function::updateAfterNameChange() {
936 LibFuncCache = UnknownLibFunc;
938 if (!
Name.starts_with(
"llvm.")) {
939 HasLLVMReservedName =
false;
940 IntID = Intrinsic::not_intrinsic;
943 HasLLVMReservedName =
true;
944 IntID = Intrinsic::lookupIntrinsicID(
Name);
951bool Function::hasAddressTaken(
const User **PutOffender,
952 bool IgnoreCallbackUses,
953 bool IgnoreAssumeLikeCalls,
bool IgnoreLLVMUsed,
954 bool IgnoreARCAttachedCall,
955 bool IgnoreCastedDirectCall)
const {
957 const User *FU =
U.getUser();
958 if (IgnoreCallbackUses) {
960 if (ACS && ACS.isCallbackCall())
964 const auto *
Call = dyn_cast<CallBase>(FU);
966 if (IgnoreAssumeLikeCalls &&
967 isa<BitCastOperator, AddrSpaceCastOperator>(FU) &&
969 if (const auto *I = dyn_cast<IntrinsicInst>(U))
970 return I->isAssumeLikeIntrinsic();
977 const User *FUU = FU;
978 if (isa<BitCastOperator, AddrSpaceCastOperator>(FU) &&
982 if (const auto *GV = dyn_cast<GlobalVariable>(U))
983 return GV->hasName() &&
984 (GV->getName() ==
"llvm.compiler.used" ||
985 GV->getName() ==
"llvm.used");
995 if (IgnoreAssumeLikeCalls) {
996 if (
const auto *
I = dyn_cast<IntrinsicInst>(Call))
997 if (
I->isAssumeLikeIntrinsic())
1001 if (!
Call->isCallee(&U) || (!IgnoreCastedDirectCall &&
1002 Call->getFunctionType() != getFunctionType())) {
1003 if (IgnoreARCAttachedCall &&
1004 Call->isOperandBundleOfType(LLVMContext::OB_clang_arc_attachedcall,
1016bool Function::isDefTriviallyDead()
const {
1018 if (!hasLinkOnceLinkage() && !hasLocalLinkage() &&
1019 !hasAvailableExternallyLinkage())
1027bool Function::callsFunctionThatReturnsTwice()
const {
1029 if (
const auto *Call = dyn_cast<CallBase>(&
I))
1030 if (
Call->hasFnAttr(Attribute::ReturnsTwice))
1036Constant *Function::getPersonalityFn()
const {
1037 assert(hasPersonalityFn() && getNumOperands());
1038 return cast<Constant>(
Op<0>());
1041void Function::setPersonalityFn(
Constant *Fn) {
1042 setHungoffOperand<0>(Fn);
1043 setValueSubclassDataBit(3, Fn !=
nullptr);
1046Constant *Function::getPrefixData()
const {
1047 assert(hasPrefixData() && getNumOperands());
1048 return cast<Constant>(
Op<1>());
1051void Function::setPrefixData(
Constant *PrefixData) {
1052 setHungoffOperand<1>(PrefixData);
1053 setValueSubclassDataBit(1, PrefixData !=
nullptr);
1056Constant *Function::getPrologueData()
const {
1057 assert(hasPrologueData() && getNumOperands());
1058 return cast<Constant>(
Op<2>());
1061void Function::setPrologueData(
Constant *PrologueData) {
1062 setHungoffOperand<2>(PrologueData);
1063 setValueSubclassDataBit(2, PrologueData !=
nullptr);
1066void Function::allocHungoffUselist() {
1068 if (getNumOperands())
1071 allocHungoffUses(3,
false);
1072 setNumHungOffUseOperands(3);
1075 auto *CPN = ConstantPointerNull::get(PointerType::get(getContext(), 0));
1082void Function::setHungoffOperand(
Constant *
C) {
1084 allocHungoffUselist();
1086 }
else if (getNumOperands()) {
1087 Op<Idx>().set(ConstantPointerNull::get(PointerType::get(getContext(), 0)));
1091void Function::setValueSubclassDataBit(
unsigned Bit,
bool On) {
1092 assert(Bit < 16 &&
"SubclassData contains only 16 bits");
1094 setValueSubclassData(getSubclassDataFromValue() | (1 << Bit));
1096 setValueSubclassData(getSubclassDataFromValue() & ~(1 << Bit));
1102 auto PrevCount = getEntryCount();
1103 assert(!PrevCount || PrevCount->getType() == Count.
getType());
1106 auto ImportGUIDs = getImportGUIDs();
1107 if (S ==
nullptr && ImportGUIDs.size())
1112 LLVMContext::MD_prof,
1121std::optional<ProfileCount> Function::getEntryCount(
bool AllowSynthetic)
const {
1122 MDNode *MD = getMetadata(LLVMContext::MD_prof);
1125 if (MDS->getString() == MDProfLabels::FunctionEntryCount) {
1131 return std::nullopt;
1133 }
else if (AllowSynthetic &&
1135 MDProfLabels::SyntheticFunctionEntryCount) {
1141 return std::nullopt;
1146 if (
MDNode *MD = getMetadata(LLVMContext::MD_prof))
1148 if (MDS->getString() == MDProfLabels::FunctionEntryCount)
1150 R.insert(mdconst::extract<ConstantInt>(MD->
getOperand(i))
1156bool Function::nullPointerIsDefined()
const {
1157 return hasFnAttribute(Attribute::NullPointerIsValid);
1160unsigned Function::getVScaleValue()
const {
1161 Attribute Attr = getFnAttribute(Attribute::VScaleRange);
1173 if (
F &&
F->nullPointerIsDefined())
1184 case CallingConv::C:
1185 case CallingConv::Fast:
1186 case CallingConv::Cold:
1187 case CallingConv::GHC:
1188 case CallingConv::HiPE:
1189 case CallingConv::AnyReg:
1190 case CallingConv::PreserveMost:
1191 case CallingConv::PreserveAll:
1192 case CallingConv::Swift:
1193 case CallingConv::CXX_FAST_TLS:
1194 case CallingConv::Tail:
1195 case CallingConv::CFGuard_Check:
1196 case CallingConv::SwiftTail:
1197 case CallingConv::PreserveNone:
1198 case CallingConv::X86_StdCall:
1199 case CallingConv::X86_FastCall:
1200 case CallingConv::ARM_APCS:
1201 case CallingConv::ARM_AAPCS:
1202 case CallingConv::ARM_AAPCS_VFP:
1203 case CallingConv::MSP430_INTR:
1204 case CallingConv::X86_ThisCall:
1205 case CallingConv::PTX_Device:
1206 case CallingConv::SPIR_FUNC:
1207 case CallingConv::Intel_OCL_BI:
1208 case CallingConv::X86_64_SysV:
1209 case CallingConv::Win64:
1210 case CallingConv::X86_VectorCall:
1211 case CallingConv::DUMMY_HHVM:
1212 case CallingConv::DUMMY_HHVM_C:
1213 case CallingConv::X86_INTR:
1214 case CallingConv::AVR_INTR:
1215 case CallingConv::AVR_SIGNAL:
1216 case CallingConv::AVR_BUILTIN:
1218 case CallingConv::AMDGPU_KERNEL:
1219 case CallingConv::SPIR_KERNEL:
1220 case CallingConv::AMDGPU_CS_Chain:
1221 case CallingConv::AMDGPU_CS_ChainPreserve:
1223 case CallingConv::AMDGPU_VS:
1224 case CallingConv::AMDGPU_HS:
1225 case CallingConv::AMDGPU_GS:
1226 case CallingConv::AMDGPU_PS:
1227 case CallingConv::AMDGPU_CS:
1228 case CallingConv::AMDGPU_LS:
1229 case CallingConv::AMDGPU_ES:
1230 case CallingConv::MSP430_BUILTIN:
1231 case CallingConv::AArch64_VectorCall:
1232 case CallingConv::AArch64_SVE_VectorCall:
1233 case CallingConv::WASM_EmscriptenInvoke:
1234 case CallingConv::AMDGPU_Gfx:
1235 case CallingConv::AMDGPU_Gfx_WholeWave:
1236 case CallingConv::M68k_INTR:
1237 case CallingConv::AArch64_SME_ABI_Support_Routines_PreserveMost_From_X0:
1238 case CallingConv::AArch64_SME_ABI_Support_Routines_PreserveMost_From_X2:
1239 case CallingConv::M68k_RTD:
1240 case CallingConv::GRAAL:
1241 case CallingConv::ARM64EC_Thunk_X64:
1242 case CallingConv::ARM64EC_Thunk_Native:
1243 case CallingConv::RISCV_VectorCall:
1244 case CallingConv::AArch64_SME_ABI_Support_Routines_PreserveMost_From_X1:
1245 case CallingConv::RISCV_VLSCall_32:
1246 case CallingConv::RISCV_VLSCall_64:
1247 case CallingConv::RISCV_VLSCall_128:
1248 case CallingConv::RISCV_VLSCall_256:
1249 case CallingConv::RISCV_VLSCall_512:
1250 case CallingConv::RISCV_VLSCall_1024:
1251 case CallingConv::RISCV_VLSCall_2048:
1252 case CallingConv::RISCV_VLSCall_4096:
1253 case CallingConv::RISCV_VLSCall_8192:
1254 case CallingConv::RISCV_VLSCall_16384:
1255 case CallingConv::RISCV_VLSCall_32768:
1256 case CallingConv::RISCV_VLSCall_65536:
static unsigned getIntrinsicID(const SDNode *N)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDGPU Lower Kernel Arguments
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Expand Atomic instructions
This file contains the simple types necessary to represent the attributes associated with functions a...
static const Function * getParent(const Value *V)
This file implements the BitVector class.
static bool setMemoryEffects(Function &F, MemoryEffects ME)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
#define LLVM_EXPORT_TEMPLATE
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Given that RA is a live propagate it s liveness to any other values it uses(according to Uses). void DeadArgumentEliminationPass
This file defines the DenseSet and SmallDenseSet classes.
Module.h This file contains the declarations for the Module class.
This defines the Use class.
Function::ProfileCount ProfileCount
This file contains the declarations for profiling metadata utility functions.
static StringRef getName(Value *V)
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
static Type * getMemoryParamAllocType(AttributeSet ParamAttrs)
For a byval, sret, inalloca, or preallocated parameter, get the in-memory parameter type.
static cl::opt< int > NonGlobalValueMaxNameSize("non-global-value-max-name-size", cl::Hidden, cl::init(1024), cl::desc("Maximum size for the name of non-global values."))
static MutableArrayRef< Argument > makeArgArray(Argument *Args, size_t Count)
static unsigned computeAddrSpace(unsigned AddrSpace, Module *M)
This file defines the SmallString class.
This file defines the SmallVector class.
static SymbolRef::Type getType(const Symbol *Sym)
uint64_t getZExtValue() const
Get zero extended value.
This class represents an incoming formal argument to a Function.
LLVM_ABI MemoryEffects getMemoryEffects() const
Returns memory effects of the function.
LLVM_ABI Type * getInAllocaType() const
LLVM_ABI Type * getByValType() const
LLVM_ABI Type * getStructRetType() const
LLVM_ABI Type * getPreallocatedType() const
LLVM_ABI Type * getByRefType() const
LLVM_ABI const ConstantRange & getRange() const
Returns the value of the range attribute.
LLVM_ABI std::optional< unsigned > getVScaleRangeMax() const
Returns the maximum value for the vscale_range attribute or std::nullopt when unknown.
LLVM_ABI unsigned getVScaleRangeMin() const
Returns the minimum value for the vscale_range attribute.
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
bool isValid() const
Return true if the attribute is any kind of attribute.
LLVM Basic Block Representation.
LLVM_ABI void dropAllReferences()
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining...
This is the shared class of boolean and integer constants.
const APInt & getValue() const
Return the constant as an APInt value reference.
This class represents a range of values.
This is an important base class in LLVM.
This class represents an Operation in the Expression.
A parsed version of the target data layout string in and methods for querying it.
Implements a dense probed hash-table based set.
Class to represent profile counts.
uint64_t getCount() const
ProfileCountType getType() const
BasicBlockListType::iterator iterator
This is an important class for using LLVM in a threaded context.
const MDOperand & getOperand(unsigned I) const
unsigned getNumOperands() const
Return number of MDNode operands.
A Module instance is used to store all the information related to an LLVM module.
const FunctionListType & getFunctionList() const
Get the Module's list of functions (constant).
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
bool isVoidTy() const
Return true if this is 'void'.
A Use represents the edge between a Value definition and its users.
LLVM Value Representation.
user_iterator user_begin()
bool hasOneUse() const
Return true if there is exactly one use of this value.
iterator_range< user_iterator > users()
void push_back(pointer val)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
LLVM_ABI LLVM_READNONE bool supportsNonVoidReturnType(CallingConv::ID CC)
LLVM_ABI AttributeList getAttributes(LLVMContext &C, ID id, FunctionType *FT)
Return the attributes for an intrinsic.
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
unsigned getPointerAddressSpace(const Type *T)
FPClassTest
Floating-point class tests, supported by 'is_fpclass' intrinsic.
LLVM_ABI bool NullPointerIsDefined(const Function *F, unsigned AS=0)
Check whether null pointer dereferencing is considered undefined behavior for a given function or an ...
bool isPointerTy(const Type *T)
DenormalMode parseDenormalFPAttribute(StringRef Str)
Returns the denormal mode to use for inputs and outputs.
bool capturesNothing(CaptureComponents CC)
Represent subnormal handling kind for floating point instruction inputs and outputs.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.