Go to the documentation of this file.
57 #include <type_traits>
64 :
Value(Ty, MetadataAsValueVal), MD(MD) {
91 auto *
N = dyn_cast<MDNode>(MD);
92 if (!
N ||
N->getNumOperands() != 1)
95 if (!
N->getOperand(0))
99 if (
auto *
C = dyn_cast<ConstantAsMetadata>(
N->getOperand(0)))
118 return Store.lookup(MD);
121 void MetadataAsValue::handleChangedMetadata(
Metadata *MD) {
127 Store.erase(this->MD);
132 auto *&Entry =
Store[MD];
144 void MetadataAsValue::track() {
149 void MetadataAsValue::untrack() {
155 assert(Ref &&
"Expected live reference");
157 "Reference without owner must be direct");
158 if (
auto *R = ReplaceableMetadataImpl::getOrCreate(MD)) {
159 R->addRef(Ref, Owner);
162 if (
auto *PH = dyn_cast<DistinctMDOperandPlaceholder>(&MD)) {
163 assert(!PH->Use &&
"Placeholders can only be used once");
164 assert(!Owner &&
"Unexpected callback to owner");
172 assert(
Ref &&
"Expected live reference");
173 if (
auto *R = ReplaceableMetadataImpl::getIfExists(MD))
175 else if (
auto *PH = dyn_cast<DistinctMDOperandPlaceholder>(&MD))
180 assert(
Ref &&
"Expected live reference");
181 assert(New &&
"Expected live reference");
183 if (
auto *R = ReplaceableMetadataImpl::getIfExists(MD)) {
184 R->moveRef(
Ref, New, MD);
187 assert(!isa<DistinctMDOperandPlaceholder>(MD) &&
188 "Unexpected move of an MDOperand");
190 "Expected un-replaceable metadata, since we didn't move a reference");
195 return ReplaceableMetadataImpl::isReplaceable(MD);
200 for (
auto Pair : UseMap) {
201 OwnerTy Owner = Pair.second.first;
206 MDUsers.push_back(OwnerMD);
211 void ReplaceableMetadataImpl::addRef(
void *Ref, OwnerTy Owner) {
213 UseMap.insert(std::make_pair(Ref, std::make_pair(Owner, NextIndex)))
216 assert(WasInserted &&
"Expected to add a reference");
219 assert(NextIndex != 0 &&
"Unexpected overflow");
222 void ReplaceableMetadataImpl::dropRef(
void *Ref) {
223 bool WasErased = UseMap.erase(Ref);
225 assert(WasErased &&
"Expected to drop a reference");
228 void ReplaceableMetadataImpl::moveRef(
void *Ref,
void *New,
230 auto I = UseMap.find(Ref);
231 assert(
I != UseMap.end() &&
"Expected to move a reference");
232 auto OwnerAndIndex =
I->second;
234 bool WasInserted = UseMap.insert(std::make_pair(New, OwnerAndIndex)).second;
236 assert(WasInserted &&
"Expected to add a reference");
240 assert((OwnerAndIndex.first || *
static_cast<Metadata **
>(Ref) == &MD) &&
241 "Reference without owner must be direct");
242 assert((OwnerAndIndex.first || *
static_cast<Metadata **
>(New) == &MD) &&
243 "Reference without owner must be direct");
251 using UseTy = std::pair<void *, std::pair<OwnerTy, uint64_t>>;
254 return L.second.second < R.second.second;
256 for (
const auto &Pair :
Uses) {
259 if (!UseMap.count(Pair.first))
262 OwnerTy Owner = Pair.second.first;
269 UseMap.erase(Pair.first);
282 #define HANDLE_METADATA_LEAF(CLASS) \
283 case Metadata::CLASS##Kind: \
284 cast<CLASS>(OwnerMD)->handleChangedOperand(Pair.first, MD); \
286 #include "llvm/IR/Metadata.def"
291 assert(UseMap.empty() &&
"Expected all uses to be replaced");
304 using UseTy = std::pair<void *, std::pair<OwnerTy, uint64_t>>;
307 return L.second.second < R.second.second;
310 for (
const auto &Pair :
Uses) {
311 auto Owner = Pair.second.first;
318 auto *OwnerMD = dyn_cast<MDNode>(Owner.get<
Metadata *>());
321 if (OwnerMD->isResolved())
323 OwnerMD->decrementUnresolvedOperandCount();
328 if (
auto *
N = dyn_cast<MDNode>(&MD))
329 return N->isResolved() ? nullptr :
N->Context.getOrCreateReplaceableUses();
330 return dyn_cast<ValueAsMetadata>(&MD);
334 if (
auto *
N = dyn_cast<MDNode>(&MD))
335 return N->isResolved() ? nullptr :
N->Context.getReplaceableUses();
336 return dyn_cast<ValueAsMetadata>(&MD);
339 bool ReplaceableMetadataImpl::isReplaceable(
const Metadata &MD) {
340 if (
auto *
N = dyn_cast<MDNode>(&MD))
341 return !
N->isResolved();
342 return dyn_cast<ValueAsMetadata>(&MD);
346 assert(V &&
"Expected value");
347 if (
auto *A = dyn_cast<Argument>(V)) {
348 if (
auto *Fn = A->getParent())
349 return Fn->getSubprogram();
354 if (
auto *Fn =
BB->getParent())
355 return Fn->getSubprogram();
363 assert(V &&
"Unexpected null Value");
368 assert((isa<Constant>(V) || isa<Argument>(V) || isa<Instruction>(V)) &&
369 "Expected constant or function-local value");
372 if (
auto *
C = dyn_cast<Constant>(V))
382 assert(V &&
"Unexpected null Value");
387 assert(V &&
"Expected valid value");
396 assert(MD &&
"Expected valid metadata");
407 assert(To &&
"Expected valid value");
408 assert(
From != To &&
"Expected changed value");
415 assert(!
From->IsUsedByMD &&
"Expected From not to be used by metadata");
420 assert(
From->IsUsedByMD &&
"Expected From to be used by metadata");
421 From->IsUsedByMD =
false;
423 assert(MD &&
"Expected valid metadata");
427 if (isa<LocalAsMetadata>(MD)) {
428 if (
auto *
C = dyn_cast<Constant>(To)) {
441 }
else if (!isa<Constant>(To)) {
448 auto *&Entry =
Store[To];
469 auto I =
Store.try_emplace(Str);
470 auto &MapEntry =
I.first->getValue();
473 MapEntry.Entry = &*
I.first;
478 assert(Entry &&
"Expected to find string map entry");
479 return Entry->first();
488 #define HANDLE_MDNODE_LEAF(CLASS) \
490 alignof(uint64_t) >= alignof(CLASS), \
491 "Alignment is insufficient after objects prepended to " #CLASS);
492 #include "llvm/IR/Metadata.def"
494 void *MDNode::operator
new(
size_t Size,
unsigned NumOps) {
495 size_t OpSize = NumOps *
sizeof(
MDOperand);
498 OpSize =
alignTo(OpSize,
alignof(uint64_t));
499 void *Ptr =
reinterpret_cast<char *
>(::operator
new(OpSize +
Size)) + OpSize;
510 size_t OpSize =
N->NumOperands *
sizeof(
MDOperand);
511 OpSize =
alignTo(OpSize,
alignof(uint64_t));
516 ::operator
delete(
reinterpret_cast<char *
>(Mem) - OpSize);
534 countUnresolvedOperands();
541 #define HANDLE_MDNODE_LEAF(CLASS) \
543 return cast<CLASS>(this)->cloneImpl();
544 #include "llvm/IR/Metadata.def"
549 if (
auto *
N = dyn_cast_or_null<MDNode>(
Op))
550 return !
N->isResolved();
554 void MDNode::countUnresolvedOperands() {
555 assert(NumUnresolved == 0 &&
"Expected unresolved ops to be uncounted");
560 void MDNode::makeUniqued() {
566 Op.reset(
Op.get(),
this);
570 countUnresolvedOperands();
571 if (!NumUnresolved) {
572 dropReplaceableUses();
579 void MDNode::makeDistinct() {
584 dropReplaceableUses();
596 dropReplaceableUses();
601 void MDNode::dropReplaceableUses() {
602 assert(!NumUnresolved &&
"Unexpected unresolved operand");
605 if (
Context.hasReplaceableUses())
606 Context.takeReplaceableUses()->resolveAllUses();
611 assert(NumUnresolved != 0 &&
"Expected unresolved operands");
619 decrementUnresolvedOperandCount();
622 void MDNode::decrementUnresolvedOperandCount() {
632 dropReplaceableUses();
645 auto *
N = dyn_cast_or_null<MDNode>(
Op);
650 "Expected all forward declarations to be resolved");
651 if (!
N->isResolved())
660 MDNode *MDNode::replaceWithPermanentImpl() {
664 return replaceWithDistinctImpl();
666 #define HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS) \
669 #include "llvm/IR/Metadata.def"
674 return replaceWithDistinctImpl();
675 return replaceWithUniquedImpl();
678 MDNode *MDNode::replaceWithUniquedImpl() {
680 MDNode *UniquedNode = uniquify();
682 if (UniquedNode ==
this) {
693 MDNode *MDNode::replaceWithDistinctImpl() {
698 void MDTuple::recalculateHash() {
699 setHash(MDTupleInfo::KeyTy::calculateHash(
this));
703 for (
unsigned I = 0,
E = NumOperands;
I !=
E; ++
I)
705 if (
Context.hasReplaceableUses()) {
706 Context.getReplaceableUses()->resolveAllUses(
false);
707 (void)
Context.takeReplaceableUses();
711 void MDNode::handleChangedOperand(
void *Ref,
Metadata *New) {
728 if (New ==
this || (!New && Old && isa<ConstantAsMetadata>(Old))) {
739 resolveAfterOperandChange(Old, New);
751 if (
Context.hasReplaceableUses())
761 void MDNode::deleteAsSubclass() {
765 #define HANDLE_MDNODE_LEAF(CLASS) \
767 delete cast<CLASS>(this); \
769 #include "llvm/IR/Metadata.def"
773 template <
class T,
class InfoT>
782 template <
class NodeTy>
struct MDNode::HasCachedHash {
785 template <
class U, U Val>
struct SFINAE {};
788 static Yes &check(
SFINAE<
void (U::*)(
unsigned), &U::setHash> *);
789 template <
class U>
static No &check(...);
791 static const bool value =
sizeof(check<NodeTy>(
nullptr)) ==
sizeof(
Yes);
794 MDNode *MDNode::uniquify() {
801 #define HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS) \
802 case CLASS##Kind: { \
803 CLASS *SubclassThis = cast<CLASS>(this); \
804 std::integral_constant<bool, HasCachedHash<CLASS>::value> \
805 ShouldRecalculateHash; \
806 dispatchRecalculateHash(SubclassThis, ShouldRecalculateHash); \
807 return uniquifyImpl(SubclassThis, getContext().pImpl->CLASS##s); \
809 #include "llvm/IR/Metadata.def"
813 void MDNode::eraseFromStore() {
817 #define HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS) \
819 getContext().pImpl->CLASS##s.erase(cast<CLASS>(this)); \
821 #include "llvm/IR/Metadata.def"
826 StorageType Storage,
bool ShouldCreate) {
829 MDTupleInfo::KeyTy
Key(MDs);
834 Hash =
Key.getHash();
836 assert(ShouldCreate &&
"Expected non-uniqued nodes to always be created");
844 assert(
N->isTemporary() &&
"Expected temporary node");
845 N->replaceAllUsesWith(
nullptr);
846 N->deleteAsSubclass();
850 assert(!
Context.hasReplaceableUses() &&
"Unexpected replaceable uses");
851 assert(!NumUnresolved &&
"Unexpected unresolved nodes");
859 #define HANDLE_MDNODE_LEAF(CLASS) \
860 case CLASS##Kind: { \
861 std::integral_constant<bool, HasCachedHash<CLASS>::value> ShouldResetHash; \
862 dispatchResetHash(cast<CLASS>(this), ShouldResetHash); \
865 #include "llvm/IR/Metadata.def"
897 if (
MDNode *
N = dyn_cast_or_null<MDNode>(Ops[0]))
898 if (
N->getNumOperands() == Ops.
size() &&
N ==
N->getOperand(0)) {
899 for (
unsigned I = 1,
E = Ops.
size();
I !=
E; ++
I)
900 if (Ops[
I] !=
N->getOperand(
I))
915 MDs.
insert(
B->op_begin(),
B->op_end());
944 for (
const MDOperand &MDOp : A->operands())
945 if (
const MDNode *NAMD = dyn_cast<MDNode>(MDOp))
950 if (
const MDNode *NAMD = dyn_cast<MDNode>(MDOp))
957 for (
const MDOperand &MDOp : A->operands())
958 if (
const MDNode *NAMD = dyn_cast<MDNode>(MDOp))
963 return MDs.
empty() ? nullptr
971 APFloat AVal = mdconst::extract<ConstantFP>(A->getOperand(0))->getValueAPF();
972 APFloat BVal = mdconst::extract<ConstantFP>(
B->getOperand(0))->getValueAPF();
979 return A.getUpper() ==
B.getLower() || A.getLower() ==
B.getUpper();
989 unsigned Size = EndPoints.size();
990 APInt LB = EndPoints[
Size - 2]->getValue();
996 EndPoints[
Size - 2] =
998 EndPoints[
Size - 1] =
1007 if (!EndPoints.empty())
1011 EndPoints.push_back(Low);
1012 EndPoints.push_back(
High);
1031 int AN = A->getNumOperands() / 2;
1032 int BN =
B->getNumOperands() / 2;
1033 while (AI < AN && BI < BN) {
1034 ConstantInt *ALow = mdconst::extract<ConstantInt>(A->getOperand(2 * AI));
1035 ConstantInt *BLow = mdconst::extract<ConstantInt>(
B->getOperand(2 * BI));
1039 mdconst::extract<ConstantInt>(A->getOperand(2 * AI + 1)));
1043 mdconst::extract<ConstantInt>(
B->getOperand(2 * BI + 1)));
1048 addRange(EndPoints, mdconst::extract<ConstantInt>(A->getOperand(2 * AI)),
1049 mdconst::extract<ConstantInt>(A->getOperand(2 * AI + 1)));
1053 addRange(EndPoints, mdconst::extract<ConstantInt>(
B->getOperand(2 * BI)),
1054 mdconst::extract<ConstantInt>(
B->getOperand(2 * BI + 1)));
1060 unsigned Size = EndPoints.size();
1065 for (
unsigned i = 0;
i <
Size - 2; ++
i) {
1066 EndPoints[
i] = EndPoints[
i + 2];
1074 if (EndPoints.size() == 2) {
1075 ConstantRange Range(EndPoints[0]->getValue(), EndPoints[1]->getValue());
1081 MDs.
reserve(EndPoints.size());
1082 for (
auto *
I : EndPoints)
1091 ConstantInt *AVal = mdconst::extract<ConstantInt>(A->getOperand(0));
1092 ConstantInt *BVal = mdconst::extract<ConstantInt>(
B->getOperand(0));
1106 NamedMDNode::NamedMDNode(
const Twine &
N)
1109 NamedMDNode::~NamedMDNode() {
1115 return (
unsigned)
getNMDOps(Operands).size();
1121 return cast_or_null<MDNode>(
N);
1142 for (
const auto &A : Attachments)
1149 for (
const auto &A : Attachments)
1151 Result.push_back(A.Node);
1156 for (
const auto &A : Attachments)
1157 Result.emplace_back(A.MDKind, A.Node);
1161 if (Result.size() > 1)
1180 if (Attachments.size() == 1 && Attachments.back().MDKind ==
ID) {
1181 Attachments.pop_back();
1185 auto OldSize = Attachments.size();
1188 return OldSize != Attachments.size();
1195 assert(!
Info.empty() &&
"bit out of sync with hash table");
1196 return Info.lookup(KindID);
1203 assert(!
Info.empty() &&
"bit out of sync with hash table");
1221 "bit out of sync with hash table");
1223 assert(!
Info.empty() &&
"Shouldn't have called this");
1229 assert(isa<Instruction>(
this) || isa<GlobalObject>(
this));
1237 Info.set(KindID, Node);
1243 "bit out of sync with hash table");
1263 assert(isa<Instruction>(
this) || isa<GlobalObject>(
this));
1279 bool Changed =
Store.erase(KindID);
1289 "bit out of sync with hash table");
1308 if (KnownIDs.
empty()) {
1318 auto &
Info = MetadataStore[
this];
1319 assert(!
Info.empty() &&
"bit out of sync with hash table");
1321 return !KnownSet.
count(
I.MDKind);
1335 if (KindID == LLVMContext::MD_dbg) {
1346 auto *Existing =
getMetadata(LLVMContext::MD_annotation);
1348 bool AppendName =
true;
1350 auto *Tuple = cast<MDTuple>(Existing);
1351 for (
auto &
N : Tuple->operands()) {
1352 if (cast<MDString>(
N.get())->getString() ==
Name)
1354 Names.push_back(
N.get());
1366 setMetadata(LLVMContext::MD_tbaa_struct,
N.TBAAStruct);
1371 MDNode *Instruction::getMetadataImpl(
unsigned KindID)
const {
1373 if (KindID == LLVMContext::MD_dbg)
1378 void Instruction::getAllMetadataImpl(
1385 std::make_pair((
unsigned)LLVMContext::MD_dbg, DbgLoc.
getAsMDNode()));
1394 "Looking for branch weights on something besides branch or select");
1396 auto *ProfileData =
getMetadata(LLVMContext::MD_prof);
1397 if (!ProfileData || ProfileData->getNumOperands() != 3)
1400 auto *ProfDataName = dyn_cast<MDString>(ProfileData->getOperand(0));
1401 if (!ProfDataName || !ProfDataName->getString().equals(
"branch_weights"))
1404 auto *CITrue = mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(1));
1405 auto *CIFalse = mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(2));
1406 if (!CITrue || !CIFalse)
1409 TrueVal = CITrue->getValue().getZExtValue();
1410 FalseVal = CIFalse->getValue().getZExtValue();
1419 getOpcode() == Instruction::IndirectBr ||
1421 "Looking for branch weights on something besides branch");
1424 auto *ProfileData =
getMetadata(LLVMContext::MD_prof);
1428 auto *ProfDataName = dyn_cast<MDString>(ProfileData->getOperand(0));
1432 if (ProfDataName->getString().equals(
"branch_weights")) {
1434 for (
unsigned i = 1;
i < ProfileData->getNumOperands();
i++) {
1435 auto *V = mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(
i));
1438 TotalVal += V->getValue().getZExtValue();
1441 }
else if (ProfDataName->getString().equals(
"VP") &&
1442 ProfileData->getNumOperands() > 3) {
1443 TotalVal = mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(2))
1453 Other->getAllMetadata(MDs);
1454 for (
auto &MD : MDs) {
1456 if (
Offset != 0 && MD.first == LLVMContext::MD_type) {
1457 auto *OffsetConst = cast<ConstantInt>(
1458 cast<ConstantAsMetadata>(MD.second->getOperand(0))->getValue());
1459 Metadata *TypeId = MD.second->getOperand(1);
1461 OffsetConst->getType(), OffsetConst->getValue() +
Offset));
1469 auto *Attachment = MD.second;
1470 if (
Offset != 0 && MD.first == LLVMContext::MD_dbg) {
1474 auto *GVE = cast<DIGlobalVariableExpression>(Attachment);
1475 GV = GVE->getVariable();
1476 E = GVE->getExpression();
1480 OrigElements =
E->getElements();
1481 std::vector<uint64_t> Elements(OrigElements.
size() + 2);
1482 Elements[0] = dwarf::DW_OP_plus_uconst;
1494 LLVMContext::MD_type,
1513 uint64_t Val = cast<ConstantInt>(
1514 cast<ConstantAsMetadata>(MD->getOperand(0))->getValue())
1516 assert(Val <= 2 &&
"unknown vcall visibility!");
1519 return VCallVisibility::VCallVisibilityPublic;
1527 return cast_or_null<DISubprogram>(
getMetadata(LLVMContext::MD_dbg));
1533 return CU->getDebugInfoForProfiling();
1548 GVs.push_back(cast<DIGlobalVariableExpression>(MD));
bool isFullSet() const
Return true if this set contains all of the elements possible for this data-type.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
LLVMContextImpl *const pImpl
static T * storeImpl(T *N, StorageType Storage, StoreT &Store)
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
unsigned getNumOperands() const
void getDebugInfo(SmallVectorImpl< DIGlobalVariableExpression * > &GVs) const
Fill the vector with all debug info attachements.
void setOperand(unsigned I, Metadata *New)
Set an operand.
const APInt & getValue() const
Return the constant as an APInt value reference.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static T * getUniqued(DenseSet< T *, InfoT > &Store, const typename InfoT::KeyTy &Key)
void set(unsigned ID, MDNode *MD)
Set an attachment to a particular node.
DISubprogram * getSubprogram() const
Get the attached subprogram.
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
MDNode * getAsMDNode() const
Return this as a bar MDNode.
bool erase(unsigned ID)
Remove attachments with the given ID.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
void setOperand(unsigned I, MDNode *New)
ArrayRef< T > getArrayRef() const
The instances of the Type class are immutable: once they are created, they are never changed.
OutputIt copy(R &&Range, OutputIt Out)
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
void dropAllReferences()
Remove all uses and clear node vector.
DenseMap< Value *, ValueAsMetadata * > ValuesAsMetadata
MDNode(LLVMContext &Context, unsigned ID, StorageType Storage, ArrayRef< Metadata * > Ops1, ArrayRef< Metadata * > Ops2=None)
auto count_if(R &&Range, UnaryPredicate P)
Wrapper function around std::count_if to count the number of times an element satisfying a given pred...
bool remove_if(UnaryPredicate P)
Remove items from the set vector based on a predicate function.
void dropUnknownNonDebugMetadata()
T get() const
Returns the value of the specified pointer type.
bool empty() const
empty - Check if the array is empty.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM ID Predecessors according to mbb< bb27, 0x8b0a7c0 > Note ADDri is not a two address instruction its result reg1037 is an operand of the PHI node in bb76 and its operand reg1039 is the result of the PHI node We should treat it as a two address code and make sure the ADDri is scheduled after any node that reads reg1039 Use info(i.e. register scavenger) to assign it a free register to allow reuse the collector could move the objects and invalidate the derived pointer This is bad enough in the first but safe points can crop up unpredictably **array_addr i32 n y store obj * new
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
op_range operands() const
void setMetadata(unsigned KindID, MDNode *Node)
Set the metadata of the specified kind to the specified node.
SmallPtrSet< MachineInstr *, 2 > Uses
LLVM Basic Block Representation.
bool is() const
Test if the Union currently holds the type matching T.
void storeDistinctInContext()
unsigned getNumOperands() const
Return number of MDNode operands.
void addOperand(MDNode *M)
This is the shared class of boolean and integer constants.
static Type * getMetadataTy(LLVMContext &C)
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
bool extractProfTotalWeight(uint64_t &TotalVal) const
Retrieve total raw weight values of a branch.
@ Ref
The access may reference the value stored in memory.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Function object to check whether the first component of a std::pair compares less than the first comp...
(vector float) vec_cmpeq(*A, *B) C
StringRef getName() const
void setVCallVisibilityMetadata(VCallVisibility Visibility)
mutable_op_range mutable_operands()
MDNode * lookup(unsigned ID) const
Returns the first attachment with the given ID or nullptr if no such attachment exists.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
MDOperand * mutable_begin()
void eraseFromParent()
Drop all references and remove the node from parent module.
ConstantRange unionWith(const ConstantRange &CR, PreferredRangeType Type=Smallest) const
Return the range that results from the union of this range with another range.
This file declares a class to represent arbitrary precision floating point values and provide a varie...
static Constant * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Analysis containing CSE Info
bool empty() const
Determine if the SetVector is empty or not.
bool extractProfMetadata(uint64_t &TrueVal, uint64_t &FalseVal) const
Retrieve the raw weight values of a conditional branch or select.
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
mir Rename Register Operands
TypedTrackingMDRef< MDNode > TrackingMDNodeRef
const MDOperand & getOperand(unsigned I) const
MDString * createString(StringRef Str)
Return the given string as metadata.
void addDebugInfo(DIGlobalVariableExpression *GV)
Attach a DIGlobalVariableExpression.
void resolveCycles()
Resolve cycles.
DenseMap< const Value *, MDAttachments > ValueMetadata
Collection of metadata used in this context.
Implements a dense probed hash-table based set.
void setSubprogram(DISubprogram *SP)
Set the attached subprogram.
bool slt(const APInt &RHS) const
Signed less than comparison.
void resolve()
Resolve a unique, unresolved node.
static MDNode * intersect(MDNode *A, MDNode *B)
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
void addAnnotationMetadata(StringRef Annotation)
Adds an !annotation metadata node with Annotation to this instruction.
void addMetadata(unsigned KindID, MDNode &MD)
Add a metadata attachment.
bool isDebugInfoForProfiling() const
Returns true if we should emit debug info for profiling.
void copyMetadata(const GlobalObject *Src, unsigned Offset)
Copy metadata from Src, adjusting offsets by Offset.
This is an important class for using LLVM in a threaded context.
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
static MDString * get(LLVMContext &Context, StringRef Str)
MDNode * getOperand(unsigned i) const
static MDNode * getMostGenericAlignmentOrDereferenceable(MDNode *A, MDNode *B)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool hasMetadata() const
Return true if this instruction has any metadata attached to it.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
void clearMetadata()
Erase all metadata attached to this Value.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
Class for arbitrary precision integers.
bool insert(const value_type &X)
Insert a new element into the SetVector.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
void insert(unsigned ID, MDNode &MD)
Adds an attachment to a particular node.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringMap< MDString, BumpPtrAllocator > MDStringCache
StringRef - Represent a constant reference to a string, i.e.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Type * getType() const
All values are typed, get the type of this value.
static MDNode * concatenate(MDNode *A, MDNode *B)
Methods for metadata merging.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
static const Function * getParent(const Value *V)
LLVMContext & getContext() const
All values hold a context through their type.
static MDNode * getMostGenericAliasScope(MDNode *A, MDNode *B)
MDNode * getMetadata(unsigned KindID) const
Get the current metadata attachments for the given kind, if any.
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
void setMetadata(unsigned KindID, MDNode *Node)
Set a particular kind of metadata attachment.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
LLVMContext & getContext() const
bool eraseMetadata(unsigned KindID)
Erase all metadata attachments with the given kind.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
void replaceAllUsesWith(Metadata *MD)
RAUW a temporary.
void stable_sort(R &&Range)
static IntegerType * getInt64Ty(LLVMContext &C)
Module * getParent()
Get the module that holds this named metadata collection.
void addTypeMetadata(unsigned Offset, Metadata *TypeID)
bool isResolved() const
Check if node is fully resolved.
void setAAMetadata(const AAMDNodes &N)
Sets the metadata on this instruction from the AAMDNodes structure.
void sort(IteratorTy Start, IteratorTy End)
static void deleteTemporary(MDNode *N)
Deallocate a node created by getTemporary.
A pair of DIGlobalVariable and DIExpression.
This class represents a range of values.
void replaceOperandWith(unsigned I, Metadata *New)
Replace a specific operand.
#define LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE
DenseMap< Metadata *, MetadataAsValue * > MetadataAsValues
Tracking metadata reference.
void getAll(SmallVectorImpl< std::pair< unsigned, MDNode * >> &Result) const
Appends all attachments for the global to Result, sorting by attachment ID.
static MDNode * getMostGenericRange(MDNode *A, MDNode *B)
This is a simple wrapper around an MDNode which provides a higher-level interface by hiding the detai...
static MDNode * getMostGenericFPMath(MDNode *A, MDNode *B)
VCallVisibility getVCallVisibility() const
size_t size() const
size - Get the array size.
void getAllMetadata(SmallVectorImpl< std::pair< unsigned, MDNode * >> &MDs) const
Appends all metadata attached to this value to MDs, sorting by KindID.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
A SetVector that performs no allocations if smaller than a certain size.
TempMDNode clone() const
Create a (temporary) clone of this.
void eraseNamedMetadata(NamedMDNode *NMD)
Remove the given NamedMDNode from this module and delete it.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
std::vector< MDNode * > DistinctMDNodes
BlockVerifier::State From
TypeID
Definitions of all of the base types for the Type system.
StringRef getString() const
void clearOperands()
Drop all references to this node's operands.
bool contains(ConstPtrType Ptr) const
void reserve(size_type N)
bool hasMetadata() const
Return true if this value has any metadata attached to it.
op_iterator op_begin() const
void get(unsigned ID, SmallVectorImpl< MDNode * > &Result) const
Appends all attachments with the given ID to Result in insertion order.
LLVM Value Representation.
Tracking metadata reference owned by Metadata.
Optional< std::vector< StOtherPiece > > Other
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.