LLVM 20.0.0git
|
This class provides computation of slot numbers for LLVM Assembly writing. More...
Public Types | |
using | ValueMap = DenseMap< const Value *, unsigned > |
ValueMap - A mapping of Values to slot numbers. | |
using | mdn_iterator = DenseMap< const MDNode *, unsigned >::iterator |
MDNode map iterators. | |
using | as_iterator = DenseMap< AttributeSet, unsigned >::iterator |
AttributeSet map iterators. | |
using | guid_iterator = DenseMap< GlobalValue::GUID, unsigned >::iterator |
GUID map iterators. | |
Public Member Functions | |
SlotTracker (const Module *M, bool ShouldInitializeAllMetadata=false) | |
Construct from a module. | |
SlotTracker (const Function *F, bool ShouldInitializeAllMetadata=false) | |
Construct from a function, starting out in incorp state. | |
SlotTracker (const ModuleSummaryIndex *Index) | |
Construct from a module summary index. | |
SlotTracker (const SlotTracker &)=delete | |
SlotTracker & | operator= (const SlotTracker &)=delete |
~SlotTracker ()=default | |
void | setProcessHook (std::function< void(AbstractSlotTrackerStorage *, const Module *, bool)>) |
void | setProcessHook (std::function< void(AbstractSlotTrackerStorage *, const Function *, bool)>) |
unsigned | getNextMetadataSlot () override |
void | createMetadataSlot (const MDNode *N) override |
getMetadataSlot - Get the slot number of a MDNode. | |
int | getLocalSlot (const Value *V) |
Return the slot number of the specified value in it's type plane. | |
int | getGlobalSlot (const GlobalValue *V) |
getGlobalSlot - Get the slot number of a global value. | |
int | getMetadataSlot (const MDNode *N) override |
getMetadataSlot - Get the slot number of a MDNode. | |
int | getAttributeGroupSlot (AttributeSet AS) |
int | getModulePathSlot (StringRef Path) |
int | getGUIDSlot (GlobalValue::GUID GUID) |
int | getTypeIdSlot (StringRef Id) |
int | getTypeIdCompatibleVtableSlot (StringRef Id) |
void | incorporateFunction (const Function *F) |
If you'd like to deal with a function instead of just a module, use this method to get its data into the SlotTracker. | |
const Function * | getFunction () const |
void | purgeFunction () |
After calling incorporateFunction, use this method to remove the most recently incorporated function from the SlotTracker. | |
mdn_iterator | mdn_begin () |
mdn_iterator | mdn_end () |
unsigned | mdn_size () const |
bool | mdn_empty () const |
as_iterator | as_begin () |
as_iterator | as_end () |
unsigned | as_size () const |
bool | as_empty () const |
void | initializeIfNeeded () |
These functions do the actual initialization. | |
int | initializeIndexIfNeeded () |
Public Member Functions inherited from llvm::AbstractSlotTrackerStorage | |
virtual | ~AbstractSlotTrackerStorage () |
virtual unsigned | getNextMetadataSlot ()=0 |
virtual void | createMetadataSlot (const MDNode *)=0 |
virtual int | getMetadataSlot (const MDNode *)=0 |
This class provides computation of slot numbers for LLVM Assembly writing.
Definition at line 698 of file AsmWriter.cpp.
using llvm::SlotTracker::as_iterator = DenseMap<AttributeSet, unsigned>::iterator |
AttributeSet map iterators.
Definition at line 821 of file AsmWriter.cpp.
using llvm::SlotTracker::guid_iterator = DenseMap<GlobalValue::GUID, unsigned>::iterator |
GUID map iterators.
Definition at line 829 of file AsmWriter.cpp.
using llvm::SlotTracker::mdn_iterator = DenseMap<const MDNode*, unsigned>::iterator |
MDNode map iterators.
Definition at line 813 of file AsmWriter.cpp.
using llvm::SlotTracker::ValueMap = DenseMap<const Value *, unsigned> |
ValueMap - A mapping of Values to slot numbers.
Definition at line 701 of file AsmWriter.cpp.
Construct from a module.
If ShouldInitializeAllMetadata
, initializes all metadata in all functions, giving correct numbering for metadata referenced only from within a function (even if no functions have been initialized).
Definition at line 969 of file AsmWriter.cpp.
Construct from a function, starting out in incorp state.
If ShouldInitializeAllMetadata
, initializes all metadata in all functions, giving correct numbering for metadata referenced only from within a function (even if no functions have been initialized).
Definition at line 974 of file AsmWriter.cpp.
|
explicit |
Construct from a module summary index.
Definition at line 978 of file AsmWriter.cpp.
|
delete |
|
default |
|
inline |
Definition at line 823 of file AsmWriter.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::begin().
|
inline |
Definition at line 826 of file AsmWriter.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::empty().
|
inline |
Definition at line 824 of file AsmWriter.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end().
|
inline |
Definition at line 825 of file AsmWriter.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size().
getMetadataSlot - Get the slot number of a MDNode.
Implements llvm::AbstractSlotTrackerStorage.
Definition at line 1222 of file AsmWriter.cpp.
References N.
int SlotTracker::getAttributeGroupSlot | ( | AttributeSet | AS | ) |
Definition at line 1245 of file AsmWriter.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), and initializeIfNeeded().
Definition at line 805 of file AsmWriter.cpp.
int SlotTracker::getGlobalSlot | ( | const GlobalValue * | V | ) |
getGlobalSlot - Get the slot number of a global value.
Definition at line 1200 of file AsmWriter.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), initializeIfNeeded(), and MI.
int SlotTracker::getGUIDSlot | ( | GlobalValue::GUID | GUID | ) |
Definition at line 1263 of file AsmWriter.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), I, and initializeIndexIfNeeded().
Return the slot number of the specified value in it's type plane.
getLocalSlot - Get the slot number for a value that is local to a function.
If something is not in the SlotTracker, return -1.
Definition at line 1235 of file AsmWriter.cpp.
References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), and initializeIfNeeded().
Referenced by llvm::ModuleSlotTracker::getLocalSlot().
getMetadataSlot - Get the slot number of a MDNode.
Implements llvm::AbstractSlotTrackerStorage.
Definition at line 1225 of file AsmWriter.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), initializeIfNeeded(), MI, and N.
int SlotTracker::getModulePathSlot | ( | StringRef | Path | ) |
Definition at line 1254 of file AsmWriter.cpp.
References llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringMap< ValueTy, AllocatorTy >::find(), I, and initializeIndexIfNeeded().
|
inlineoverridevirtual |
Implements llvm::AbstractSlotTrackerStorage.
Definition at line 783 of file AsmWriter.cpp.
int SlotTracker::getTypeIdCompatibleVtableSlot | ( | StringRef | Id | ) |
Definition at line 1281 of file AsmWriter.cpp.
References llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringMap< ValueTy, AllocatorTy >::find(), I, and initializeIndexIfNeeded().
int SlotTracker::getTypeIdSlot | ( | StringRef | Id | ) |
Definition at line 1272 of file AsmWriter.cpp.
References llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringMap< ValueTy, AllocatorTy >::find(), I, and initializeIndexIfNeeded().
If you'd like to deal with a function instead of just a module, use this method to get its data into the SlotTracker.
Definition at line 800 of file AsmWriter.cpp.
References F.
Referenced by llvm::ModuleSlotTracker::incorporateFunction().
|
inline |
These functions do the actual initialization.
< Prevent re-processing next time we're called.
Definition at line 981 of file AsmWriter.cpp.
Referenced by getAttributeGroupSlot(), getGlobalSlot(), getLocalSlot(), and getMetadataSlot().
int SlotTracker::initializeIndexIfNeeded | ( | ) |
< Prevent re-processing next time we're called.
Definition at line 991 of file AsmWriter.cpp.
Referenced by getGUIDSlot(), getModulePathSlot(), getTypeIdCompatibleVtableSlot(), and getTypeIdSlot().
|
inline |
Definition at line 815 of file AsmWriter.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::begin().
|
inline |
Definition at line 818 of file AsmWriter.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::empty().
|
inline |
Definition at line 816 of file AsmWriter.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end().
|
inline |
Definition at line 817 of file AsmWriter.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size().
|
delete |
void SlotTracker::purgeFunction | ( | ) |
After calling incorporateFunction, use this method to remove the most recently incorporated function from the SlotTracker.
Clean up after incorporating a function.
This will reset the state of the machine back to just the module contents.
This is the only way to get out of the function incorporation state that affects get*Slot/Create*Slot. Function incorporation state is indicated by TheFunction != 0.
Definition at line 1191 of file AsmWriter.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::clear(), and ST_DEBUG.
Referenced by llvm::ModuleSlotTracker::incorporateFunction().
void SlotTracker::setProcessHook | ( | std::function< void(AbstractSlotTrackerStorage *, const Function *, bool)> | Fn | ) |
Definition at line 1215 of file AsmWriter.cpp.
void SlotTracker::setProcessHook | ( | std::function< void(AbstractSlotTrackerStorage *, const Module *, bool)> | Fn | ) |
Definition at line 1209 of file AsmWriter.cpp.
Referenced by llvm::ModuleSlotTracker::getMachine().