LLVM  3.7.0
Public Member Functions | List of all members
llvm::ModuleSlotTracker Class Reference

Manage lifetime of a slot tracker for printing IR. More...

#include <ModuleSlotTracker.h>

Public Member Functions

 ModuleSlotTracker (SlotTracker &Machine, const Module *M, const Function *F=nullptr)
 Wrap a preinitialized SlotTracker. More...
 
 ModuleSlotTracker (const Module *M, bool ShouldInitializeAllMetadata=true)
 Construct a slot tracker from a module. More...
 
 ~ModuleSlotTracker ()
 Destructor to clean up storage. More...
 
SlotTrackergetMachine () const
 
const ModulegetModule () const
 
const FunctiongetCurrentFunction () const
 
void incorporateFunction (const Function &F)
 Incorporate the given function. More...
 

Detailed Description

Manage lifetime of a slot tracker for printing IR.

Wrapper around the SlotTracker used internally by 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 ModuleSlotTracker, strings like "<badref>" will be printed, or, worse, the wrong slots entirely.

Definition at line 29 of file ModuleSlotTracker.h.

Constructor & Destructor Documentation

ModuleSlotTracker::ModuleSlotTracker ( SlotTracker Machine,
const Module M,
const Function F = nullptr 
)

Wrap a preinitialized SlotTracker.

Definition at line 669 of file AsmWriter.cpp.

ModuleSlotTracker::ModuleSlotTracker ( const Module M,
bool  ShouldInitializeAllMetadata = true 
)
explicit

Construct a slot tracker from a module.

If M is nullptr, uses a null slot tracker. Otherwise, initializes a slot tracker, and initializes all metadata slots. ShouldInitializeAllMetadata defaults to true because this is expected to be shared between multiple callers, and otherwise MDNode references will not match up.

Definition at line 673 of file AsmWriter.cpp.

ModuleSlotTracker::~ModuleSlotTracker ( )

Destructor to clean up storage.

Definition at line 679 of file AsmWriter.cpp.

Member Function Documentation

const Function* llvm::ModuleSlotTracker::getCurrentFunction ( ) const
inline

Definition at line 57 of file ModuleSlotTracker.h.

SlotTracker* llvm::ModuleSlotTracker::getMachine ( ) const
inline
const Module* llvm::ModuleSlotTracker::getModule ( ) const
inline

Definition at line 56 of file ModuleSlotTracker.h.

Referenced by llvm::Value::printAsOperand(), and printAsOperandImpl().

void ModuleSlotTracker::incorporateFunction ( const Function F)

Incorporate the given function.

Purge the currently incorporated function and incorporate F. If F is currently incorporated, this is a no-op.

Definition at line 681 of file AsmWriter.cpp.

Referenced by llvm::Value::print(), and llvm::MachineFunction::print().


The documentation for this class was generated from the following files: