class ModuleSlotTracker
Declaration
class ModuleSlotTracker { /* full declaration omitted */ };
Description
Manage lifetime of a slot tracker for printing IR. Wrapper around the \a SlotTracker used internally by \a AsmWriter. This class allows callers to share the cost of incorporating the metadata in a module or a function. If the IR changes from underneath \a ModuleSlotTracker, strings like "<badref>" will be printed, or, worse, the wrong slots entirely.
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:44
Member Variables
- private std::unique_ptr<SlotTracker> MachineStorage
- Storage for a slot tracker.
- private bool ShouldCreateStorage = false
- private bool ShouldInitializeAllMetadata = false
- private const llvm::Module* M = nullptr
- private const llvm::Function* F = nullptr
- private llvm::SlotTracker* Machine = nullptr
- private std::function<void(AbstractSlotTrackerStorage*, const Module*, bool)> ProcessModuleHookFn
- private std::function<void(AbstractSlotTrackerStorage*, const Function*, bool)> ProcessFunctionHookFn
Method Overview
- public ModuleSlotTracker(llvm::SlotTracker & Machine, const llvm::Module * M, const llvm::Function * F = nullptr)
- public ModuleSlotTracker(const llvm::Module * M, bool ShouldInitializeAllMetadata = true)
- public void collectMDNodes(llvm::ModuleSlotTracker::MachineMDNodeListType & L, unsigned int LB, unsigned int UB) const
- public const llvm::Function * getCurrentFunction() const
- public int getLocalSlot(const llvm::Value * V)
- public llvm::SlotTracker * getMachine()
- public const llvm::Module * getModule() const
- public void incorporateFunction(const llvm::Function & F)
- public void setProcessHook(std::function<void (AbstractSlotTrackerStorage *, const Module *, bool)>)
- public void setProcessHook(std::function<void (AbstractSlotTrackerStorage *, const Function *, bool)>)
- public virtual ~ModuleSlotTracker()
Methods
¶ModuleSlotTracker(
llvm::SlotTracker& Machine,
const llvm::Module* M,
const llvm::Function* F = nullptr)
ModuleSlotTracker(
llvm::SlotTracker& Machine,
const llvm::Module* M,
const llvm::Function* F = nullptr)
Description
Wrap a preinitialized SlotTracker.
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:61
Parameters
- llvm::SlotTracker& Machine
- const llvm::Module* M
- const llvm::Function* F = nullptr
¶ModuleSlotTracker(
const llvm::Module* M,
bool ShouldInitializeAllMetadata = true)
ModuleSlotTracker(
const llvm::Module* M,
bool ShouldInitializeAllMetadata = true)
Description
Construct a slot tracker from a module. If \a M is \c nullptr, uses a null slot tracker. Otherwise, initializes a slot tracker, and initializes all metadata slots. \c ShouldInitializeAllMetadata defaults to true because this is expected to be shared between multiple callers, and otherwise MDNode references will not match up.
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:71
Parameters
- const llvm::Module* M
- bool ShouldInitializeAllMetadata = true
¶void collectMDNodes(llvm::ModuleSlotTracker::
MachineMDNodeListType& L,
unsigned int LB,
unsigned int UB) const
void collectMDNodes(llvm::ModuleSlotTracker::
MachineMDNodeListType& L,
unsigned int LB,
unsigned int UB) const
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:104
Parameters
- llvm::ModuleSlotTracker::MachineMDNodeListType& L
- unsigned int LB
- unsigned int UB
¶const llvm::Function* getCurrentFunction() const
const llvm::Function* getCurrentFunction() const
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:81
¶int getLocalSlot(const llvm::Value* V)
int getLocalSlot(const llvm::Value* V)
Description
Return the slot number of the specified local value. A function that defines this value should be incorporated prior to calling this method. Return -1 if the value is not in the function's SlotTracker.
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:94
Parameters
- const llvm::Value* V
¶llvm::SlotTracker* getMachine()
llvm::SlotTracker* getMachine()
Description
Lazily creates a slot tracker.
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:78
¶const llvm::Module* getModule() const
const llvm::Module* getModule() const
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:80
¶void incorporateFunction(const llvm::Function& F)
void incorporateFunction(const llvm::Function& F)
Description
Incorporate the given function. Purge the currently incorporated function and incorporate \c F. If \c F is currently incorporated, this is a no-op.
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:87
Parameters
- const llvm::Function& F
¶void setProcessHook(
std::function<
void(AbstractSlotTrackerStorage*,
const Module*,
bool)>)
void setProcessHook(
std::function<
void(AbstractSlotTrackerStorage*,
const Module*,
bool)>)
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:96
Parameters
- std::function<void(AbstractSlotTrackerStorage*, const Module*, bool)>
¶void setProcessHook(
std::function<
void(AbstractSlotTrackerStorage*,
const Function*,
bool)>)
void setProcessHook(
std::function<
void(AbstractSlotTrackerStorage*,
const Function*,
bool)>)
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:98
Parameters
- std::function<void(AbstractSlotTrackerStorage*, const Function*, bool)>
¶virtual ~ModuleSlotTracker()
virtual ~ModuleSlotTracker()
Description
Destructor to clean up storage.
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:75