43 assert(Ty &&
"Value defined with a null type: Error!");
45 "Cannot have values with typed pointer types");
50 : SubclassID(scid), HasValueHandle(0), SubclassOptionalData(0),
51 SubclassData(0), NumUserOperands(0), IsUsedByMD(
false), HasName(
false),
53 static_assert(ConstantFirstVal == 0,
"!(SubclassID < ConstantFirstVal)");
58 if (SubclassID >= InstructionVal)
59 OpCode = SubclassID - InstructionVal;
60 if (OpCode == Instruction::Call || OpCode == Instruction::Invoke ||
61 OpCode == Instruction::CallBr)
62 assert((VTy->isFirstClassType() || VTy->isVoidTy() || VTy->isStructTy()) &&
63 "invalid CallBase type!");
64 else if (SubclassID != BasicBlockVal &&
65 ( SubclassID > ConstantLastVal))
66 assert((VTy->isFirstClassType() || VTy->isVoidTy()) &&
67 "Cannot create non-first-class values except for constants!");
68 static_assert(
sizeof(Value) == 2 *
sizeof(
void *) + 2 *
sizeof(
unsigned),
75 ValueHandleBase::ValueIsDeleted(
this);
76 if (isUsedByMetadata())
77 ValueAsMetadata::handleDeletion(
this);
89 if (!materialized_use_empty()) {
90 dbgs() <<
"While deleting: " << *VTy <<
" %" <<
getName() <<
"\n";
91 for (
auto *U :
users())
92 dbgs() <<
"Use still stuck around after Def is destroyed:" << *
U <<
"\n";
103void Value::deleteValue() {
104 switch (getValueID()) {
105#define HANDLE_VALUE(Name) \
106 case Value::Name##Val: \
107 delete static_cast<Name *>(this); \
109#define HANDLE_MEMORY_VALUE(Name) \
110 case Value::Name##Val: \
111 static_cast<DerivedUser *>(this)->DeleteValue( \
112 static_cast<DerivedUser *>(this)); \
114#define HANDLE_CONSTANT(Name) \
115 case Value::Name##Val: \
116 llvm_unreachable("constants should be destroyed with destroyConstant"); \
118#define HANDLE_INSTRUCTION(Name)
119#include "llvm/IR/Value.def"
121#define HANDLE_INST(N, OPC, CLASS) \
122 case addEnumValues(Value::InstructionVal, Instruction::OPC): \
123 delete static_cast<CLASS *>(this); \
125#define HANDLE_USER_INST(N, OPC, CLASS)
126#include "llvm/IR/Instruction.def"
133void Value::destroyValueName() {
139 setValueName(
nullptr);
142bool Value::hasNUses(
unsigned N)
const {
150bool Value::hasNUsesOrMore(
unsigned N)
const {
158bool Value::hasOneUser()
const {
163 return std::equal(++user_begin(), user_end(), user_begin());
168Use *Value::getSingleUndroppableUse() {
170 for (Use &U : uses()) {
171 if (!
U.getUser()->isDroppable()) {
180User *Value::getUniqueUndroppableUser() {
182 for (
auto *U :
users()) {
183 if (!
U->isDroppable()) {
184 if (Result && Result != U)
192bool Value::hasNUndroppableUses(
unsigned int N)
const {
196bool Value::hasNUndroppableUsesOrMore(
unsigned int N)
const {
200void Value::dropDroppableUses(
201 llvm::function_ref<
bool(
const Use *)> ShouldDrop) {
202 SmallVector<Use *, 8> ToBeEdited;
203 for (Use &U : uses())
204 if (
U.getUser()->isDroppable() && ShouldDrop(&U))
206 for (Use *U : ToBeEdited)
207 dropDroppableUse(*U);
210void Value::dropDroppableUsesIn(User &Usr) {
213 if (UsrOp.get() ==
this)
214 dropDroppableUse(UsrOp);
218void Value::dropDroppableUse(Use &U) {
220 unsigned OpNo =
U.getOperandNo();
222 U.set(ConstantInt::getTrue(
Assume->getContext()));
224 U.set(PoisonValue::get(
U.get()->getType()));
225 CallInst::BundleOpInfo &BOI =
Assume->getBundleOpInfoForOperand(OpNo);
226 BOI.
Tag =
Assume->getContext().pImpl->getOrInsertBundleTag(
"ignore");
234bool Value::isUsedInBasicBlock(
const BasicBlock *BB)
const {
235 assert(hasUseList() &&
"ConstantData has no use-list");
243 BasicBlock::const_iterator BI = BB->
begin(), BE = BB->
end();
244 const_user_iterator UI = user_begin(), UE = user_end();
245 for (; BI != BE && UI != UE; ++BI, ++UI) {
251 if (User &&
User->getParent() == BB)
257unsigned Value::getNumUses()
const {
261 return (
unsigned)std::distance(use_begin(), use_end());
267 if (BasicBlock *
P =
I->getParent())
268 if (Function *PP =
P->getParent())
269 ST = PP->getValueSymbolTable();
272 ST =
P->getValueSymbolTable();
274 if (
Module *
P = GV->getParent())
275 ST = &
P->getValueSymbolTable();
277 if (Function *
P =
A->getParent())
278 ST =
P->getValueSymbolTable();
280 assert(isa<Constant>(
V) &&
"Unknown value type!");
287 if (!HasName)
return nullptr;
292 "No name entry found!");
297void Value::setValueName(ValueName *VN) {
301 "HasName bit out of sync!");
314StringRef Value::getName()
const {
319 return StringRef(
"", 0);
320 return getValueName()->getKey();
323void Value::setNameImpl(
const Twine &NewName) {
325 !
getContext().shouldDiscardValueNames() || isa<GlobalValue>(
this);
329 if (!NeedNewName && !hasName())
336 SmallString<256> NameData;
337 StringRef NameRef = NeedNewName ? NewName.
toStringRef(NameData) :
"";
338 assert(!NameRef.
contains(0) &&
"Null bytes are not allowed in names");
344 assert(!
getType()->isVoidTy() &&
"Cannot assign a name to void values!");
347 ValueSymbolTable *
ST;
353 if (!NameRef.
empty()) {
364 setValueName(NewValueName);
365 getValueName()->setValue(
this);
370 if (!NameRef.
empty())
371 NewValueName =
ST->createValueName(NameRef,
this);
377 ST->removeValueName(getValueName());
385 assert(NeedNewName && NewValueName !=
nullptr);
386 setValueName(NewValueName);
389void Value::setName(
const Twine &NewName) {
390 setNameImpl(NewName);
392 F->updateAfterNameChange();
395void Value::takeName(
Value *
V) {
396 assert(
V !=
this &&
"Illegal call to this->takeName(this)!");
397 ValueSymbolTable *
ST =
nullptr;
404 if (
V->hasName())
V->setName(
"");
410 ST->removeValueName(getValueName());
417 if (!
V->hasName())
return;
429 ValueSymbolTable *VST;
431 assert(!Failure &&
"V has a name, so it should have a ST!"); (void)Failure;
437 setValueName(
V->getValueName());
438 V->setValueName(
nullptr);
439 getValueName()->setValue(
this);
447 VST->removeValueName(
V->getValueName());
448 setValueName(
V->getValueName());
449 V->setValueName(
nullptr);
450 getValueName()->setValue(
this);
453 ST->reinsertValue(
this);
456std::string Value::getNameOrAsOperand()
const {
461 raw_string_ostream OS(BBName);
462 printAsOperand(OS,
false);
466void Value::assertModuleIsMaterializedImpl()
const {
479static bool contains(SmallPtrSetImpl<ConstantExpr *> &Cache, ConstantExpr *Expr,
481 if (!Cache.
insert(Expr).second)
508 SmallPtrSet<ConstantExpr *, 4> Cache;
513void Value::doRAUW(
Value *New, ReplaceMetadataUses ReplaceMetaUses) {
514 assert(hasUseList() &&
"Cannot replace constant data");
515 assert(New &&
"Value::replaceAllUsesWith(<null>) is invalid!");
517 "this->replaceAllUsesWith(expr(this)) is NOT valid!");
519 "replaceAllUses of value with new value of different type!");
523 ValueHandleBase::ValueIsRAUWd(
this, New);
524 if (ReplaceMetaUses == ReplaceMetadataUses::Yes && isUsedByMetadata())
525 ValueAsMetadata::handleRAUW(
this, New);
527 while (!materialized_use_empty()) {
532 if (!isa<GlobalValue>(
C)) {
533 C->handleOperandChange(
this, New);
544 BlockAddress::lookup(BB)->handleOperandChange(
this, New);
548void Value::replaceAllUsesWith(
Value *New) {
549 doRAUW(New, ReplaceMetadataUses::Yes);
552void Value::replaceNonMetadataUsesWith(
Value *New) {
553 doRAUW(New, ReplaceMetadataUses::No);
556bool Value::replaceUsesWithIf(
Value *New,
557 llvm::function_ref<
bool(Use &U)> ShouldReplace) {
558 assert(New &&
"Value::replaceUsesWithIf(<null>) is invalid!");
560 "replaceUses of value with new value of different type!");
562 SmallVector<TrackingVH<Constant>, 8> Consts;
563 SmallPtrSet<Constant *, 8> Visited;
567 if (!ShouldReplace(U))
574 if (!isa<GlobalValue>(
C)) {
583 while (!Consts.
empty()) {
595 SmallVector<DbgVariableRecord *> DPUsers;
597 for (
auto *DVR : DPUsers) {
598 DbgMarker *Marker = DVR->getMarker();
600 DVR->replaceVariableLocationOp(
V, New);
606void Value::replaceUsesOutsideBlock(
Value *New, BasicBlock *BB) {
607 assert(New &&
"Value::replaceUsesOutsideBlock(<null>, BB) is invalid!");
609 "this->replaceUsesOutsideBlock(expr(this), BB) is NOT valid!");
611 "replaceUses of value with new value of different type!");
612 assert(BB &&
"Basic block that may contain a use of 'New' must be defined\n");
615 replaceUsesWithIf(New, [BB](Use &U) {
618 return !
I ||
I->getParent() != BB;
624enum PointerStripKind {
626 PSK_ZeroIndicesAndAliases,
627 PSK_ZeroIndicesSameRepresentation,
628 PSK_ForAliasAnalysis,
629 PSK_InBoundsConstantIndices,
636template <Po
interStripKind StripKind>
640 if (!
V->getType()->isPointerTy())
645 SmallPtrSet<const Value *, 4> Visited;
652 case PSK_ZeroIndices:
653 case PSK_ZeroIndicesAndAliases:
654 case PSK_ZeroIndicesSameRepresentation:
655 case PSK_ForAliasAnalysis:
656 if (!
GEP->hasAllZeroIndices())
659 case PSK_InBoundsConstantIndices:
660 if (!
GEP->hasAllConstantIndices())
664 if (!
GEP->isInBounds())
668 V =
GEP->getPointerOperand();
669 }
else if (Operator::getOpcode(
V) == Instruction::BitCast) {
670 Value *NewV = cast<Operator>(
V)->getOperand(0);
671 if (!NewV->getType()->isPointerTy())
674 }
else if (StripKind != PSK_ZeroIndicesSameRepresentation &&
675 Operator::getOpcode(
V) == Instruction::AddrSpaceCast) {
678 V = cast<Operator>(
V)->getOperand(0);
679 }
else if (StripKind == PSK_ZeroIndicesAndAliases && isa<GlobalAlias>(
V)) {
680 V = cast<GlobalAlias>(
V)->getAliasee();
681 }
else if (StripKind == PSK_ForAliasAnalysis && isa<PHINode>(
V) &&
682 cast<PHINode>(
V)->getNumIncomingValues() == 1) {
683 V = cast<PHINode>(
V)->getIncomingValue(0);
686 if (
const Value *RV =
Call->getReturnedArgOperand()) {
693 if (StripKind == PSK_ForAliasAnalysis &&
694 Call->getIntrinsicID() == Intrinsic::launder_invariant_group) {
695 V =
Call->getArgOperand(0);
701 assert(
V->getType()->isPointerTy() &&
"Unexpected operand type!");
702 }
while (Visited.
insert(
V).second);
707const Value *Value::stripPointerCasts()
const {
711const Value *Value::stripPointerCastsAndAliases()
const {
715const Value *Value::stripPointerCastsSameRepresentation()
const {
719const Value *Value::stripInBoundsConstantOffsets()
const {
723const Value *Value::stripPointerCastsForAliasAnalysis()
const {
727const Value *Value::stripAndAccumulateConstantOffsets(
728 const DataLayout &
DL, APInt &Offset,
bool AllowNonInbounds,
729 bool AllowInvariantGroup,
730 function_ref<
bool(
Value &, APInt &)> ExternalAnalysis,
731 bool LookThroughIntToPtr)
const {
732 if (!
getType()->isPtrOrPtrVectorTy())
737 "The offset bit width does not match the DL specification.");
741 SmallPtrSet<const Value *, 4> Visited;
747 if (!AllowNonInbounds && !
GEP->isInBounds())
756 APInt GEPOffset(
DL.getIndexTypeSizeInBits(
V->getType()), 0);
757 if (!
GEP->accumulateConstantOffset(
DL, GEPOffset, ExternalAnalysis))
763 if (GEPOffset.getSignificantBits() >
BitWidth)
768 APInt GEPOffsetST = GEPOffset.sextOrTrunc(
BitWidth);
769 if (!ExternalAnalysis) {
772 bool Overflow =
false;
776 Offset = std::move(OldOffset);
780 V =
GEP->getPointerOperand();
781 }
else if (Operator::getOpcode(
V) == Instruction::BitCast) {
782 const Value *Src = cast<Operator>(
V)->getOperand(0);
783 if (!Src->getType()->isPtrOrPtrVectorTy())
786 }
else if (Operator::getOpcode(
V) == Instruction::AddrSpaceCast) {
787 V = cast<Operator>(
V)->getOperand(0);
789 if (!GA->isInterposable())
790 V = GA->getAliasee();
792 if (
const Value *RV =
Call->getReturnedArgOperand())
794 if (AllowInvariantGroup &&
795 Call->getIntrinsicID() == Intrinsic::launder_invariant_group)
796 V =
Call->getArgOperand(0);
799 if (!AllowNonInbounds || !LookThroughIntToPtr || !Int2Ptr ||
800 Int2Ptr->getOpcode() != Instruction::IntToPtr ||
801 Int2Ptr->getOperand(0)->getType()->getScalarSizeInBits() !=
BitWidth)
814 V = Ptr2Int->getOperand(0);
816 assert(
V->getType()->isPtrOrPtrVectorTy() &&
"Unexpected operand type!");
817 }
while (Visited.
insert(
V).second);
823Value::stripInBoundsOffsets(function_ref<
void(
const Value *)> Func)
const {
827bool Value::canBeFreed()
const {
832 if (isa<Constant>(
this))
838 if (isa<AllocaInst>(
this))
844 if (
A->hasPointeeInMemoryValueAttr())
850 const Function *
F =
A->getParent();
851 if (
F->doesNotFreeMemory())
857 if ((
A->hasNoFreeAttr() ||
A->onlyReadsMemory()) &&
A->hasNoAliasAttr())
862 if (
A->hasAttribute(Attribute::NoFreeObj))
867 ITP && ITP->hasMetadata(LLVMContext::MD_nofreeobj))
871 if (CB->hasRetAttr(Attribute::NoFreeObj))
874 const Function *
F =
nullptr;
876 F =
I->getFunction();
892 const auto &GCName =
F->getGC();
893 if (GCName ==
"statepoint-example") {
894 auto *PT = cast<PointerType>(this->
getType());
895 if (PT->getAddressSpace() != 1)
905 for (
auto &Fn : *
F->getParent())
906 if (Fn.getIntrinsicID() == Intrinsic::experimental_gc_statepoint)
913uint64_t Value::getPointerDereferenceableBytes(
const DataLayout &
DL,
915 bool *CanBeFreed)
const {
920 bool CanNotBeFreed =
false;
922 DerefBytes =
A->getDereferenceableBytes();
923 if (DerefBytes == 0) {
925 if (
Type *ArgMemTy =
A->getPointeeInMemoryValueType()) {
926 if (ArgMemTy->isSized()) {
928 DerefBytes =
DL.getTypeStoreSize(ArgMemTy).getKnownMinValue();
933 if (DerefBytes == 0) {
934 DerefBytes =
A->getDereferenceableOrNullBytes();
938 DerefBytes =
Call->getRetDereferenceableBytes();
939 if (DerefBytes == 0) {
940 DerefBytes =
Call->getRetDereferenceableOrNullBytes();
943 }
else if (isa<LoadInst, IntToPtrInst>(
this)) {
944 auto *
I = cast<Instruction>(
this);
945 if (MDNode *MD =
I->getMetadata(LLVMContext::MD_dereferenceable)) {
946 ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
949 if (DerefBytes == 0) {
951 I->getMetadata(LLVMContext::MD_dereferenceable_or_null)) {
952 ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
958 if (std::optional<TypeSize> Size = AI->getAllocationSize(
DL)) {
959 DerefBytes =
Size->getKnownMinValue();
961 CanNotBeFreed =
true;
967 DerefBytes =
DL.getTypeStoreSize(GV->
getValueType()).getFixedValue();
969 CanNotBeFreed =
true;
976 if (!CanNotBeFreed && DerefBytes != 0)
977 *CanBeFreed = canBeFreed();
985Align Value::getPointerAlignment(
const DataLayout &
DL)
const {
988 Align FunctionPtrAlign =
DL.getFunctionPtrAlign().valueOrOne();
989 switch (
DL.getFunctionPtrAlignType()) {
990 case DataLayout::FunctionPtrAlignType::Independent:
991 return FunctionPtrAlign;
992 case DataLayout::FunctionPtrAlignType::MultipleOfFunctionAlign:
993 return std::max(FunctionPtrAlign,
F->getAlign().valueOrOne());
997 const MaybeAlign
Alignment(GVar->getAlign());
999 Type *ObjectType = GVar->getValueType();
1000 if (ObjectType->isSized()) {
1004 if (GVar->isStrongDefinitionForLinker())
1005 return DL.getPreferredAlign(GVar);
1007 return DL.getABITypeAlign(ObjectType);
1012 const MaybeAlign
Alignment =
A->getParamAlign();
1013 if (!Alignment &&
A->hasStructRetAttr()) {
1015 Type *EltTy =
A->getParamStructRetType();
1016 if (EltTy->isSized())
1017 return DL.getABITypeAlign(EltTy);
1021 return AI->getAlign();
1023 return Call->getRetAlign().valueOrOne();
1025 if (MDNode *MD = LI->getMetadata(LLVMContext::MD_align)) {
1026 ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
1031 if (
CE->getOpcode() == Instruction::IntToPtr &&
1032 isa<ConstantInt>(
CE->getOperand(0))) {
1033 ConstantInt *IntPtr = cast<ConstantInt>(
CE->getOperand(0));
1037 return Align(TrailingZeros < Value::MaxAlignmentExponent
1039 : Value::MaximumAlignment);
1045static std::optional<int64_t>
1049 for (
unsigned i = 1; i !=
Idx; ++i, ++GTI)
1054 for (
unsigned i = Idx, e =
GEP->getNumOperands(); i != e; ++i, ++GTI) {
1057 return std::nullopt;
1070 if (
Size.isScalable())
1071 return std::nullopt;
1078std::optional<int64_t> Value::getPointerOffsetFrom(
const Value *Other,
1079 const DataLayout &
DL)
const {
1081 const Value *Ptr2 =
this;
1082 APInt Offset1(
DL.getIndexTypeSizeInBits(Ptr1->getType()), 0);
1083 APInt Offset2(
DL.getIndexTypeSizeInBits(Ptr2->getType()), 0);
1084 Ptr1 = Ptr1->stripAndAccumulateConstantOffsets(
DL, Offset1,
true);
1085 Ptr2 = Ptr2->stripAndAccumulateConstantOffsets(
DL, Offset2,
true);
1089 return Offset2.getSExtValue() - Offset1.getSExtValue();
1101 return std::nullopt;
1111 if (!IOffset1 || !IOffset2)
1112 return std::nullopt;
1113 return *IOffset2 - *IOffset1 + Offset2.getSExtValue() -
1114 Offset1.getSExtValue();
1117const Value *Value::DoPHITranslation(
const BasicBlock *CurBB,
1118 const BasicBlock *PredBB)
const {
1120 if (PN && PN->getParent() == CurBB)
1121 return PN->getIncomingValueForBlock(PredBB);
1125void Value::reverseUseList() {
1126 if (!UseList || !UseList->Next)
1130 Use *Head = UseList;
1131 Use *Current = UseList->Next;
1132 Head->Next =
nullptr;
1135 Current->Next = Head;
1136 Head->Prev = &Current->Next;
1141 Head->Prev = &UseList;
1144bool Value::isSwiftError()
const {
1147 return Arg->hasSwiftErrorAttr();
1151 return Alloca->isSwiftError();
1158ValueHandleHead::ValueHandleHead(ValueHandleHead &&Other) noexcept
1159 : Head(
Other.Head) {
1160 if (ValueHandleBase *Ptr =
get())
1161 Ptr->setPrevPtr(&Head);
1164void ValueHandleBase::AddToExistingUseList(ValueHandleBase **List) {
1165 assert(List &&
"Handle list is null?");
1168 Next = ValueHandleHead::exchange(List,
this).getPointer();
1171 Next->setPrevPtr(&Next);
1172 assert(getValPtr() ==
Next->getValPtr() &&
"Added to wrong list?");
1176void ValueHandleBase::AddToExistingUseListAfter(ValueHandleBase *List) {
1177 assert(List &&
"Must insert after existing node");
1180 setPrevPtr(&
List->Next);
1183 Next->setPrevPtr(&Next);
1186void ValueHandleBase::AddToUseList() {
1187 assert(getValPtr() &&
"Null pointer doesn't have a use list!");
1189 LLVMContextImpl *pImpl = getValPtr()->getContext().pImpl;
1191 assert(getValPtr()->hasValueHandle() == (
Entry.get() !=
nullptr) &&
1192 "HasValueHandle and ValueHandles out of sync!");
1193 AddToExistingUseList(
Entry.getAddress());
1194 getValPtr()->HasValueHandle =
true;
1197void ValueHandleBase::RemoveFromUseList() {
1198 assert(getValPtr() && getValPtr()->HasValueHandle &&
1199 "Pointer doesn't have a use list!");
1202 ValueHandleBase **PrevPtr = getPrevPtr();
1203 auto [OldPtr, IsHead] = ValueHandleHead::exchange(PrevPtr, Next);
1204 assert(OldPtr ==
this &&
"List invariant broken");
1206 assert(
Next->getPrevPtr() == &Next &&
"List invariant broken");
1207 Next->setPrevPtr(PrevPtr);
1215 LLVMContextImpl *pImpl = getValPtr()->getContext().pImpl;
1217 getValPtr()->HasValueHandle =
false;
1221void ValueHandleBase::ValueIsDeleted(
Value *
V) {
1222 assert(
V->HasValueHandle &&
"Should only be called if ValueHandles present");
1226 LLVMContextImpl *pImpl =
V->getContext().pImpl;
1228 assert(Entry &&
"Value bit set but no entries exist");
1241 Iterator.AddToExistingUseListAfter(Entry);
1242 assert(
Entry->Next == &Iterator &&
"Loop invariant broken.");
1244 switch (
Entry->getKind()) {
1251 Entry->operator=(
nullptr);
1255 static_cast<CallbackVH*
>(
Entry)->deleted();
1261 if (
V->HasValueHandle) {
1263 dbgs() <<
"While deleting: " << *
V->getType() <<
" %" <<
V->getName()
1274void ValueHandleBase::ValueIsRAUWd(
Value *Old,
Value *New) {
1275 assert(Old->HasValueHandle &&
"Should only be called if ValueHandles present");
1276 assert(Old != New &&
"Changing value into itself!");
1277 assert(Old->getType() ==
New->getType() &&
1278 "replaceAllUses of value with new value of different type!");
1282 LLVMContextImpl *pImpl = Old->getContext().pImpl;
1285 assert(Entry &&
"Value bit set but no entries exist");
1293 Iterator.AddToExistingUseListAfter(Entry);
1294 assert(
Entry->Next == &Iterator &&
"Loop invariant broken.");
1296 switch (
Entry->getKind()) {
1307 static_cast<CallbackVH*
>(
Entry)->allUsesReplacedWith(New);
1315 if (Old->HasValueHandle)
1317 switch (
Entry->getKind()) {
1319 dbgs() <<
"After RAUW from " << *Old->getType() <<
" %"
1320 << Old->getName() <<
" to " << *
New->getType() <<
" %"
1321 <<
New->getName() <<
"\n";
1323 "A weak tracking value handle still pointed to the old value!\n");
1331void CallbackVH::anchor() {}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
This file defines the DenseMap class.
Module.h This file contains the declarations for the Module class.
Machine Check Debug Module
static StringRef getName(Value *V)
Func getContext().diagnose(DiagnosticInfoUnsupported(Func
static std::optional< int64_t > getOffsetFromIndex(const GEPOperator *GEP, unsigned Idx, const DataLayout &DL)
static void NoopCallback(const Value *)
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
static Type * checkType(Type *Ty)
static bool getSymTab(Value *V, ValueSymbolTable *&ST)
static const Value * stripPointerCastsAndOffsets(const Value *V, function_ref< void(const Value *)> Func=NoopCallback< StripKind >)
static void replaceDbgUsesOutsideBlock(Value *V, Value *New, BasicBlock *BB)
Replace debug record uses of MetadataAsValue(ValueAsMetadata(V)) outside BB with New.
static bool isUnDroppableUser(const User *U)
This file defines the SmallString class.
static SymbolRef::Type getType(const Symbol *Sym)
unsigned countr_zero() const
Count the number of trailing zero bits.
LLVM_ABI void replaceSuccessorsPhiUsesWith(BasicBlock *Old, BasicBlock *New)
Update all phi nodes in this basic block's successors to refer to basic block New instead of basic bl...
iterator begin()
Instruction iterator methods.
const Function * getParent() const
Return the enclosing method, or null if none.
bool hasAddressTaken() const
Returns true if there are any uses of this basic block other than direct branches,...
uint64_t getLimitedValue(uint64_t Limit=~0ULL) const
getLimitedValue - If the value is smaller than the specified limit, return it, otherwise return the l...
bool isZero() const
This is just a convenience method to make client code smaller for a common code.
int64_t getSExtValue() const
Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the ...
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
const APInt & getValue() const
Return the constant as an APInt value reference.
LLVM_ABI const BasicBlock * getParent() const
bool erase(const KeyT &Val)
LLVM_ABI Type * getSourceElementType() const
bool hasExternalWeakLinkage() const
Module * getParent()
Get the module that this global value is contained inside of...
Type * getValueType() const
DenseMap< const Value *, ValueName * > ValueNames
ValueHandlesTy ValueHandles
LLVMContextImpl *const pImpl
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
void push_back(const T &Elt)
static StringMapEntry * create(StringRef key, AllocatorTy &allocator, InitTy &&...initVals)
constexpr bool empty() const
Check if the string is empty.
bool contains(StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
bool isTriviallyEmpty() const
Check if this twine is trivially empty; a false return value does not necessarily mean the twine is e...
StringRef toStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single StringRef if it can be represented as such.
bool isSized() const
Return true if it makes sense to take the size of this type.
LLVM_ABI bool isDroppable() const
A droppable user is a user for which uses can be dropped without affecting correctness and should be ...
Value * getOperand(unsigned i) const
unsigned getNumOperands() const
LLVM_ABI Value(Type *Ty, unsigned scid)
LLVM_ABI ~Value()
Value's destructor should be virtual by design, but that would require that Value and all of its subc...
StructType * getStructTypeOrNull() const
TypeSize getSequentialElementStride(const DataLayout &DL) const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
@ CE
Windows NT (Windows on ARM)
llvm::unique_function< void(llvm::Expected< T >)> Callback
A Callback<T> is a void function that accepts Expected<T>.
@ User
could "use" a pointer
NodeAddr< UseNode * > Use
NodeAddr< FuncNode * > Func
This is an optimization pass for GlobalISel generic memory operations.
StringMapEntry< Value * > ValueName
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
bool hasNItemsOrMore(IterTy &&Begin, IterTy &&End, unsigned N, Pred &&ShouldBeCounted=[](const decltype(*std::declval< IterTy >()) &) { return true;}, std::enable_if_t< !std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< std::remove_reference_t< decltype(Begin)> >::iterator_category >::value, void > *=nullptr)
Return true if the sequence [Begin, End) has N or more items.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
bool hasNItems(IterTy &&Begin, IterTy &&End, unsigned N, Pred &&ShouldBeCounted=[](const decltype(*std::declval< IterTy >()) &) { return true;}, std::enable_if_t< !std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< std::remove_reference_t< decltype(Begin)> >::iterator_category >::value, void > *=nullptr)
Return true if the sequence [Begin, End) has exactly N items.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isPointerTy(const Type *T)
generic_gep_type_iterator<> gep_type_iterator
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
gep_type_iterator gep_type_begin(const User *GEP)
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Next
LLVM_ABI void findDbgUsers(Value *V, SmallVectorImpl< DbgVariableRecord * > &DbgVariableRecords)
Finds the debug info records describing a value.
StringMapEntry< uint32_t > * Tag
The operand bundle tag, interned by LLVMContextImpl::getOrInsertBundleTag.