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:29
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 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 ~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:41
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:51
Parameters
- const llvm::Module* M
- bool ShouldInitializeAllMetadata = true
¶const llvm::Function* getCurrentFunction() const
const llvm::Function* getCurrentFunction() const
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:61
¶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:74
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:58
¶const llvm::Module* getModule() const
const llvm::Module* getModule() const
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:60
¶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:67
Parameters
- const llvm::Function& F
¶~ModuleSlotTracker()
~ModuleSlotTracker()
Description
Destructor to clean up storage.
Declared at: llvm/include/llvm/IR/ModuleSlotTracker.h:55