57 #include <type_traits> 64 :
Value(Ty, MetadataAsValueVal), MD(MD) {
69 getType()->getContext().pImpl->MetadataAsValues.erase(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];
134 replaceAllUsesWith(Entry);
144 void MetadataAsValue::track() {
149 void MetadataAsValue::untrack() {
155 assert(
Ref &&
"Expected live reference");
156 assert((Owner || *static_cast<Metadata **>(
Ref) == &MD) &&
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");
182 assert(Ref != New &&
"Expected change");
183 if (
auto *R = ReplaceableMetadataImpl::getIfExists(MD)) {
184 R->moveRef(Ref, New, MD);
187 assert(!isa<DistinctMDOperandPlaceholder>(MD) &&
188 "Unexpected move of an MDOperand");
189 assert(!isReplaceable(MD) &&
190 "Expected un-replaceable metadata, since we didn't move a reference");
195 return ReplaceableMetadataImpl::isReplaceable(MD);
198 void ReplaceableMetadataImpl::addRef(
void *
Ref,
OwnerTy Owner) {
200 UseMap.insert(std::make_pair(
Ref, std::make_pair(Owner, NextIndex)))
203 assert(WasInserted &&
"Expected to add a reference");
206 assert(NextIndex != 0 &&
"Unexpected overflow");
209 void ReplaceableMetadataImpl::dropRef(
void *
Ref) {
210 bool WasErased = UseMap.erase(Ref);
212 assert(WasErased &&
"Expected to drop a reference");
215 void ReplaceableMetadataImpl::moveRef(
void *
Ref,
void *New,
217 auto I = UseMap.find(
Ref);
218 assert(
I != UseMap.end() &&
"Expected to move a reference");
219 auto OwnerAndIndex =
I->second;
221 bool WasInserted = UseMap.insert(std::make_pair(New, OwnerAndIndex)).second;
223 assert(WasInserted &&
"Expected to add a reference");
227 assert((OwnerAndIndex.first || *static_cast<Metadata **>(
Ref) == &MD) &&
228 "Reference without owner must be direct");
229 assert((OwnerAndIndex.first || *static_cast<Metadata **>(New) == &MD) &&
230 "Reference without owner must be direct");
238 using UseTy = std::pair<void *, std::pair<OwnerTy, uint64_t>>;
240 llvm::sort(Uses, [](
const UseTy &L,
const UseTy &R) {
241 return L.second.second < R.second.second;
243 for (
const auto &Pair : Uses) {
246 if (!UseMap.count(Pair.first))
249 OwnerTy Owner = Pair.second.first;
256 UseMap.erase(Pair.first);
269 #define HANDLE_METADATA_LEAF(CLASS) \ 270 case Metadata::CLASS##Kind: \ 271 cast<CLASS>(OwnerMD)->handleChangedOperand(Pair.first, MD); \ 273 #include "llvm/IR/Metadata.def" 278 assert(UseMap.empty() &&
"Expected all uses to be replaced");
291 using UseTy = std::pair<void *, std::pair<OwnerTy, uint64_t>>;
293 llvm::sort(Uses, [](
const UseTy &L,
const UseTy &R) {
294 return L.second.second < R.second.second;
297 for (
const auto &Pair : Uses) {
298 auto Owner = Pair.second.first;
308 if (OwnerMD->isResolved())
310 OwnerMD->decrementUnresolvedOperandCount();
315 if (
auto *
N = dyn_cast<MDNode>(&MD))
316 return N->isResolved() ? nullptr :
N->Context.getOrCreateReplaceableUses();
321 if (
auto *
N = dyn_cast<MDNode>(&MD))
322 return N->isResolved() ? nullptr :
N->Context.getReplaceableUses();
326 bool ReplaceableMetadataImpl::isReplaceable(
const Metadata &MD) {
327 if (
auto *
N = dyn_cast<MDNode>(&MD))
328 return !
N->isResolved();
333 assert(V &&
"Expected value");
334 if (
auto *A = dyn_cast<Argument>(V)) {
335 if (
auto *Fn = A->getParent())
336 return Fn->getSubprogram();
341 if (
auto *Fn = BB->getParent())
342 return Fn->getSubprogram();
350 assert(V &&
"Unexpected null Value");
355 assert((isa<Constant>(V) || isa<Argument>(V) || isa<Instruction>(V)) &&
356 "Expected constant or function-local value");
359 if (
auto *
C = dyn_cast<Constant>(V))
369 assert(V &&
"Unexpected null Value");
374 assert(V &&
"Expected valid value");
383 assert(MD &&
"Expected valid metadata");
393 assert(From &&
"Expected valid value");
394 assert(To &&
"Expected valid value");
395 assert(From != To &&
"Expected changed value");
399 auto &
Store = Context.pImpl->ValuesAsMetadata;
400 auto I =
Store.find(From);
410 assert(MD &&
"Expected valid metadata");
414 if (isa<LocalAsMetadata>(MD)) {
415 if (
auto *
C = dyn_cast<Constant>(To)) {
428 }
else if (!isa<Constant>(To)) {
435 auto *&Entry =
Store[To];
456 auto I =
Store.try_emplace(Str);
457 auto &MapEntry =
I.first->getValue();
460 MapEntry.Entry = &*
I.first;
465 assert(Entry &&
"Expected to find string map entry");
466 return Entry->first();
475 #define HANDLE_MDNODE_LEAF(CLASS) \ 477 alignof(uint64_t) >= alignof(CLASS), \ 478 "Alignment is insufficient after objects prepended to " #CLASS); 479 #include "llvm/IR/Metadata.def" 481 void *MDNode::operator
new(
size_t Size,
unsigned NumOps) {
482 size_t OpSize = NumOps *
sizeof(
MDOperand);
485 OpSize =
alignTo(OpSize,
alignof(uint64_t));
486 void *Ptr =
reinterpret_cast<char *
>(::operator
new(OpSize +
Size)) + OpSize;
493 void MDNode::operator
delete(
void *Mem) {
495 size_t OpSize = N->NumOperands *
sizeof(
MDOperand);
496 OpSize =
alignTo(OpSize,
alignof(uint64_t));
499 for (
MDOperand *
E = O - N->NumOperands; O !=
E; --O)
501 ::operator
delete(
reinterpret_cast<char *
>(Mem) - OpSize);
507 NumUnresolved(0), Context(Context) {
519 countUnresolvedOperands();
526 #define HANDLE_MDNODE_LEAF(CLASS) \ 528 return cast<CLASS>(this)->cloneImpl(); 529 #include "llvm/IR/Metadata.def" 534 if (
auto *
N = dyn_cast_or_null<MDNode>(Op))
535 return !
N->isResolved();
539 void MDNode::countUnresolvedOperands() {
540 assert(NumUnresolved == 0 &&
"Expected unresolved ops to be uncounted");
545 void MDNode::makeUniqued() {
551 Op.reset(
Op.get(),
this);
555 countUnresolvedOperands();
556 if (!NumUnresolved) {
557 dropReplaceableUses();
564 void MDNode::makeDistinct() {
569 dropReplaceableUses();
581 dropReplaceableUses();
586 void MDNode::dropReplaceableUses() {
587 assert(!NumUnresolved &&
"Unexpected unresolved operand");
596 assert(NumUnresolved != 0 &&
"Expected unresolved operands");
604 decrementUnresolvedOperandCount();
607 void MDNode::decrementUnresolvedOperandCount() {
617 dropReplaceableUses();
630 auto *
N = dyn_cast_or_null<MDNode>(
Op);
635 "Expected all forward declarations to be resolved");
636 if (!
N->isResolved())
648 MDNode *MDNode::replaceWithPermanentImpl() {
652 return replaceWithDistinctImpl();
654 #define HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS) \ 657 #include "llvm/IR/Metadata.def" 662 return replaceWithDistinctImpl();
663 return replaceWithUniquedImpl();
666 MDNode *MDNode::replaceWithUniquedImpl() {
668 MDNode *UniquedNode = uniquify();
670 if (UniquedNode ==
this) {
681 MDNode *MDNode::replaceWithDistinctImpl() {
686 void MDTuple::recalculateHash() {
687 setHash(MDTupleInfo::KeyTy::calculateHash(
this));
691 for (
unsigned I = 0,
E = NumOperands;
I !=
E; ++
I)
699 void MDNode::handleChangedOperand(
void *
Ref,
Metadata *New) {
716 if (New ==
this || (!New && Old && isa<ConstantAsMetadata>(Old))) {
727 resolveAfterOperandChange(Old, New);
749 void MDNode::deleteAsSubclass() {
753 #define HANDLE_MDNODE_LEAF(CLASS) \ 755 delete cast<CLASS>(this); \ 757 #include "llvm/IR/Metadata.def" 761 template <
class T,
class InfoT>
770 template <
class NodeTy>
struct MDNode::HasCachedHash {
773 template <
class U, U Val>
struct SFINAE {};
776 static Yes &check(
SFINAE<
void (U::*)(
unsigned), &U::setHash> *);
777 template <
class U>
static No &check(...);
779 static const bool value =
sizeof(check<NodeTy>(
nullptr)) ==
sizeof(
Yes);
782 MDNode *MDNode::uniquify() {
789 #define HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS) \ 790 case CLASS##Kind: { \ 791 CLASS *SubclassThis = cast<CLASS>(this); \ 792 std::integral_constant<bool, HasCachedHash<CLASS>::value> \ 793 ShouldRecalculateHash; \ 794 dispatchRecalculateHash(SubclassThis, ShouldRecalculateHash); \ 795 return uniquifyImpl(SubclassThis, getContext().pImpl->CLASS##s); \ 797 #include "llvm/IR/Metadata.def" 801 void MDNode::eraseFromStore() {
805 #define HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS) \ 807 getContext().pImpl->CLASS##s.erase(cast<CLASS>(this)); \ 809 #include "llvm/IR/Metadata.def" 817 MDTupleInfo::KeyTy
Key(MDs);
822 Hash = Key.getHash();
824 assert(ShouldCreate &&
"Expected non-uniqued nodes to always be created");
834 N->deleteAsSubclass();
838 assert(!Context.hasReplaceableUses() &&
"Unexpected replaceable uses");
839 assert(!NumUnresolved &&
"Unexpected unresolved nodes");
847 #define HANDLE_MDNODE_LEAF(CLASS) \ 848 case CLASS##Kind: { \ 849 std::integral_constant<bool, HasCachedHash<CLASS>::value> ShouldResetHash; \ 850 dispatchResetHash(cast<CLASS>(this), ShouldResetHash); \ 853 #include "llvm/IR/Metadata.def" 885 if (
MDNode *
N = dyn_cast_or_null<MDNode>(Ops[0]))
886 if (
N->getNumOperands() == Ops.
size() &&
N ==
N->getOperand(0)) {
887 for (
unsigned I = 1,
E = Ops.
size();
I !=
E; ++
I)
888 if (Ops[
I] !=
N->getOperand(
I))
953 APInt LB = EndPoints[Size - 2]->getValue();
954 APInt LE = EndPoints[Size - 1]->getValue();
959 EndPoints[Size - 2] =
961 EndPoints[Size - 1] =
970 if (!EndPoints.
empty())
996 while (AI < AN && BI < BN) {
1002 mdconst::extract<ConstantInt>(A->
getOperand(2 * AI + 1)));
1006 mdconst::extract<ConstantInt>(B->
getOperand(2 * BI + 1)));
1012 mdconst::extract<ConstantInt>(A->
getOperand(2 * AI + 1)));
1017 mdconst::extract<ConstantInt>(B->
getOperand(2 * BI + 1)));
1028 for (
unsigned i = 0; i < Size - 2; ++i) {
1029 EndPoints[i] = EndPoints[i + 2];
1031 EndPoints.
resize(Size - 2);
1037 if (EndPoints.
size() == 2) {
1038 ConstantRange Range(EndPoints[0]->getValue(), EndPoints[1]->getValue());
1045 for (
auto *
I : EndPoints)
1069 NamedMDNode::NamedMDNode(
const Twine &
N)
1078 return (
unsigned)
getNMDOps(Operands).size();
1084 return cast_or_null<MDNode>(
N);
1104 for (
auto &
I : Attachments)
1105 if (
I.first == ID) {
1106 I.second.reset(&MD);
1109 Attachments.emplace_back(std::piecewise_construct, std::make_tuple(ID),
1110 std::make_tuple(&MD));
1118 if (Attachments.back().first ==
ID) {
1119 Attachments.pop_back();
1123 for (
auto I = Attachments.begin(),
E = std::prev(Attachments.end());
I !=
E;
1125 if (
I->first == ID) {
1126 *
I = std::move(Attachments.back());
1127 Attachments.pop_back();
1135 for (
const auto &
I : Attachments)
1143 Result.append(Attachments.begin(), Attachments.end());
1146 if (Result.size() > 1)
1155 for (
const auto &A : Attachments)
1163 for (
const auto &A : Attachments)
1170 [
ID](
const Attachment &A) {
return A.MDKind ==
ID; });
1171 bool Changed =
I != Attachments.end();
1172 Attachments.erase(
I, Attachments.end());
1178 for (
const auto &A : Attachments)
1179 Result.emplace_back(A.MDKind, A.Node);
1184 Result.begin(), Result.end(),
1185 [](
const std::pair<unsigned, MDNode *> &A,
1186 const std::pair<unsigned, MDNode *> &
B) {
return A.first <
B.first; });
1190 if (!Node && !hasMetadata())
1196 return getMetadataImpl(
getContext().getMDKindID(Kind));
1200 if (!hasMetadataHashEntry())
1207 if (KnownSet.
empty()) {
1209 InstructionMetadata.erase(
this);
1210 setHasMetadataHashEntry(
false);
1214 auto &
Info = InstructionMetadata[
this];
1215 Info.remove_if([&KnownSet](
const std::pair<unsigned, TrackingMDNodeRef> &
I) {
1216 return !KnownSet.
count(I.first);
1221 InstructionMetadata.erase(
this);
1222 setHasMetadataHashEntry(
false);
1227 if (!Node && !hasMetadata())
1239 assert(!
Info.empty() == hasMetadataHashEntry() &&
1240 "HasMetadata bit is wonked");
1242 setHasMetadataHashEntry(
true);
1243 Info.set(KindID, *Node);
1248 assert((hasMetadataHashEntry() ==
1249 (
getContext().pImpl->InstructionMetadata.count(
this) > 0)) &&
1250 "HasMetadata bit out of date!");
1251 if (!hasMetadataHashEntry())
1262 setHasMetadataHashEntry(
false);
1271 MDNode *Instruction::getMetadataImpl(
unsigned KindID)
const {
1274 return DbgLoc.getAsMDNode();
1276 if (!hasMetadataHashEntry())
1279 assert(!
Info.empty() &&
"bit out of sync with hash table");
1281 return Info.lookup(KindID);
1284 void Instruction::getAllMetadataImpl(
1292 if (!hasMetadataHashEntry())
1296 assert(hasMetadataHashEntry() &&
1297 getContext().pImpl->InstructionMetadata.count(
this) &&
1298 "Shouldn't have called this");
1300 assert(!Info.empty() &&
"Shouldn't have called this");
1301 Info.getAll(Result);
1304 void Instruction::getAllMetadataOtherThanDebugLocImpl(
1307 assert(hasMetadataHashEntry() &&
1308 getContext().pImpl->InstructionMetadata.count(
this) &&
1309 "Shouldn't have called this");
1311 assert(!Info.empty() &&
"Shouldn't have called this");
1312 Info.getAll(Result);
1316 uint64_t &FalseVal)
const {
1319 "Looking for branch weights on something besides branch or select");
1322 if (!ProfileData || ProfileData->getNumOperands() != 3)
1326 if (!ProfDataName || !ProfDataName->getString().equals(
"branch_weights"))
1329 auto *CITrue = mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(1));
1330 auto *CIFalse = mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(2));
1331 if (!CITrue || !CIFalse)
1334 TrueVal = CITrue->getValue().getZExtValue();
1335 FalseVal = CIFalse->getValue().getZExtValue();
1346 "Looking for branch weights on something besides branch");
1357 if (ProfDataName->getString().equals(
"branch_weights")) {
1359 for (
unsigned i = 1; i < ProfileData->getNumOperands(); i++) {
1360 auto *V = mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(i));
1363 TotalVal += V->getValue().getZExtValue();
1366 }
else if (ProfDataName->getString().equals(
"VP") &&
1367 ProfileData->getNumOperands() > 3) {
1368 TotalVal = mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(2))
1376 void Instruction::clearMetadataHashEntries() {
1377 assert(hasMetadataHashEntry() &&
"Caller should check");
1379 setHasMetadataHashEntry(
false);
1391 getMetadata(
getContext().getMDKindID(Kind), MDs);
1396 setHasMetadataHashEntry(
true);
1402 addMetadata(
getContext().getMDKindID(Kind), MD);
1411 bool Changed =
Store.erase(KindID);
1431 setHasMetadataHashEntry(
false);
1435 eraseMetadata(KindID);
1437 addMetadata(KindID, *N);
1451 return getMetadata(
getContext().getMDKindID(Kind));
1457 for (
auto &MD : MDs) {
1460 auto *OffsetConst = cast<ConstantInt>(
1461 cast<ConstantAsMetadata>(MD.second->getOperand(0))->getValue());
1462 Metadata *TypeId = MD.second->getOperand(1);
1464 OffsetConst->getType(), OffsetConst->getValue() +
Offset));
1472 auto *Attachment = MD.second;
1477 auto *GVE = cast<DIGlobalVariableExpression>(Attachment);
1478 GV = GVE->getVariable();
1479 E = GVE->getExpression();
1483 OrigElements = E->getElements();
1484 std::vector<uint64_t> Elements(OrigElements.
size() + 2);
1485 Elements[0] = dwarf::DW_OP_plus_uconst;
1491 addMetadata(MD.first, *Attachment);
1515 return CU->getDebugInfoForProfiling();
1530 GVs.
push_back(cast<DIGlobalVariableExpression>(MD));
IntegerType * getType() const
getType - Specialize the getType() method to always return an IntegerType, which reduces the amount o...
static void deleteTemporary(MDNode *N)
Deallocate a node created by getTemporary.
Tracking metadata reference owned by Metadata.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
StringMap< MDString, BumpPtrAllocator > MDStringCache
ConstantRange unionWith(const ConstantRange &CR) const
Return the range that results from the union of this range with another range.
MDNode * Scope
The tag for alias scope specification (used with noalias).
MDNode * getOperand(unsigned i) const
This class represents lattice values for constants.
const APInt & getUpper() const
Return the upper value for this range.
MDNode * TBAA
The tag for type-based alias analysis.
void replaceOperandWith(unsigned I, Metadata *New)
Replace a specific operand.
static MDString * get(LLVMContext &Context, StringRef Str)
void clearOperands()
Drop all references to this node's operands.
Implements a dense probed hash-table based set.
std::unique_ptr< ReplaceableMetadataImpl > takeReplaceableUses()
Drop RAUW support.
void push_back(const T &Elt)
DenseMap< Value *, ValueAsMetadata * > ValuesAsMetadata
static MDNode * getMostGenericAliasScope(MDNode *A, MDNode *B)
bool slt(const APInt &RHS) const
Signed less than comparison.
void addOperand(MDNode *M)
void storeDistinctInContext()
LLVMContext & getContext() const
All values hold a context through their type.
auto count_if(R &&Range, UnaryPredicate P) -> typename std::iterator_traits< decltype(adl_begin(Range))>::difference_type
Wrapper function around std::count_if to count the number of times an element satisfying a given pred...
const MDOperand & getOperand(unsigned I) const
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
static T * storeImpl(T *N, StorageType Storage, StoreT &Store)
static IntegerType * getInt64Ty(LLVMContext &C)
void setOperand(unsigned I, Metadata *New)
Set an operand.
static Type * getMetadataTy(LLVMContext &C)
void getAllMetadata(SmallVectorImpl< std::pair< unsigned, MDNode *>> &MDs) const
Appends all attachments for the global to MDs, sorting by attachment ID.
void reserve(size_type N)
void setOperand(unsigned I, MDNode *New)
op_iterator op_end() const
TempMDNode clone() const
Create a (temporary) clone of this.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
void set(unsigned ID, MDNode &MD)
Set an attachment to a particular node.
TypedTrackingMDRef< MDNode > TrackingMDNodeRef
void copyMetadata(const GlobalObject *Src, unsigned Offset)
Copy metadata from Src, adjusting offsets by Offset.
DenseMap< const Instruction *, MDAttachmentMap > InstructionMetadata
Collection of per-instruction metadata used in this context.
LLVM_NODISCARD bool empty() const
amdgpu Simplify well known AMD library false Value Value const Twine & Name
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool isResolved() const
Check if node is fully resolved.
void eraseFromParent()
Drop all references and remove the node from parent module.
static Optional< unsigned > getOpcode(ArrayRef< VPValue *> Values)
Returns the opcode of Values or ~0 if they do not all agree.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
The access may reference the value stored in memory.
MDNode * getMetadata(unsigned KindID) const
Get the current metadata attachments for the given kind, if any.
TypeID
Definitions of all of the base types for the Type system.
unsigned getNumOperands() const
std::vector< MDNode * > DistinctMDNodes
This file implements a class to represent arbitrary precision integral constant values and operations...
void resolveCycles()
Resolve cycles.
op_iterator op_begin() const
Type * getType() const
All values are typed, get the type of this value.
void dropUnknownNonDebugMetadata()
op_range operands() const
LLVMContext & getContext() const
ConstantRange intersectWith(const ConstantRange &CR) const
Return the range that results from the intersection of this range with another range.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
const APInt & getValue() const
Return the constant as an APInt value reference.
static MDNode * intersect(MDNode *A, MDNode *B)
bool extractProfTotalWeight(uint64_t &TotalVal) const
Retrieve total raw weight values of a branch.
void replaceAllUsesWith(Metadata *MD)
RAUW a temporary.
MDNode * lookup(unsigned ID) const
Get a particular attachment (if any).
Analysis containing CSE Info
void resolve()
Resolve a unique, unresolved node.
StringRef getString() const
MDNode * lookup(unsigned ID) const
Returns the first attachment with the given ID or nullptr if no such attachment exists.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
bool isDebugInfoForProfiling() const
Returns true if we should emit debug info for profiling.
static MDNode * getMostGenericRange(MDNode *A, MDNode *B)
void setSubprogram(DISubprogram *SP)
Set the attached subprogram.
void array_pod_sort(IteratorTy Start, IteratorTy End)
array_pod_sort - This sorts an array with the specified start and end extent.
static T * getUniqued(DenseSet< T *, InfoT > &Store, const typename InfoT::KeyTy &Key)
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void addTypeMetadata(unsigned Offset, Metadata *TypeID)
void setAAMetadata(const AAMDNodes &N)
Sets the metadata on this instruction from the AAMDNodes structure.
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.
DISubprogram * getSubprogram() const
Get the attached subprogram.
static MDNode * getMostGenericAlignmentOrDereferenceable(MDNode *A, MDNode *B)
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
std::pair< iterator, bool > insert(const ValueT &V)
void getDebugInfo(SmallVectorImpl< DIGlobalVariableExpression *> &GVs) const
Fill the vector with all debug info attachements.
A pair of DIGlobalVariable and DIExpression.
void getAll(SmallVectorImpl< std::pair< unsigned, MDNode *>> &Result) const
Appends all attachments for the global to Result, sorting by attachment ID.
This file declares a class to represent arbitrary precision floating point values and provide a varie...
bool isFullSet() const
Return true if this set contains all of the elements possible for this data-type. ...
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
auto remove_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::remove_if which take ranges instead of having to pass begin/end explicitly...
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&... Args)
static wasm::ValType getType(const TargetRegisterClass *RC)
C setMetadata(LLVMContext::MD_range, MDNode::get(Context, LowAndHigh))
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void setMetadata(unsigned KindID, MDNode *Node)
Set the metadata of the specified kind to the specified node.
mutable_op_range mutable_operands()
LLVMContextImpl *const pImpl
void sort(IteratorTy Start, IteratorTy End)
constexpr bool empty(const T &RangeOrContainer)
Test whether RangeOrContainer is empty. Similar to C++17 std::empty.
bool isEmptySet() const
Return true if this set contains no members.
DenseMap< Metadata *, MetadataAsValue * > MetadataAsValues
bool hasReplaceableUses() const
Whether this contains RAUW support.
DenseMap< const GlobalObject *, MDGlobalAttachmentMap > GlobalObjectMetadata
Collection of per-GlobalObject metadata used in this context.
A SetVector that performs no allocations if smaller than a certain size.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
This is the shared class of boolean and integer constants.
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
BlockVerifier::State From
MDNode(LLVMContext &Context, unsigned ID, StorageType Storage, ArrayRef< Metadata *> Ops1, ArrayRef< Metadata *> Ops2=None)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
This class represents a range of values.
void addMetadata(unsigned KindID, MDNode &MD)
Add a metadata attachment.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
MDNode * NoAlias
The tag specifying the noalias scope.
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.
void get(unsigned ID, SmallVectorImpl< MDNode *> &Result) const
Appends all attachments with the given ID to Result in insertion order.
Class for arbitrary precision integers.
void insert(unsigned ID, MDNode &MD)
StringRef getName() const
void setMetadata(unsigned KindID, MDNode *MD)
Set a particular kind of metadata attachment.
MDOperand * mutable_begin()
void getAll(SmallVectorImpl< std::pair< unsigned, MDNode *>> &Result) const
Copy out all the attachments.
LLVM_NODISCARD bool empty() const
static MDNode * concatenate(MDNode *A, MDNode *B)
Methods for metadata merging.
const APInt & getLower() const
Return the lower value for this range.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
std::string str() const
Return the twine contents as a std::string.
T get() const
Returns the value of the specified pointer type.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
bool erase(unsigned ID)
Remove an attachment.
static const Function * getParent(const Value *V)
void addDebugInfo(DIGlobalVariableExpression *GV)
Attach a DIGlobalVariableExpression.
StringRef - Represent a constant reference to a string, i.e.
int is() const
Test if the Union currently holds the type matching T.
bool eraseMetadata(unsigned KindID)
Erase all metadata attachments with the given kind.
unsigned getNumOperands() const
Return number of MDNode operands.
bool extractProfMetadata(uint64_t &TrueVal, uint64_t &FalseVal) const
Retrieve the raw weight values of a conditional branch or select.
static MDNode * getMostGenericFPMath(MDNode *A, MDNode *B)
OutputIt copy(R &&Range, OutputIt Out)
ReplaceableMetadataImpl * getReplaceableUses() const
bool empty() const
empty - Check if the array is empty.
cmpResult compare(const APFloat &RHS) const
A discriminated union of two pointer types, with the discriminator in the low bit of the pointer...
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.