class SlotTracker

Declaration

class SlotTracker : public AbstractSlotTrackerStorage { /* full declaration omitted */ };

Description

This class provides computation of slot numbers for LLVM Assembly writing.

Declared at: llvm/lib/IR/AsmWriter.cpp:656

Inherits from: AbstractSlotTrackerStorage

Member Variables

private const llvm::Module* TheModule
TheModule - The module for which we are holding slot numbers.
private const llvm::Function* TheFunction = nullptr
TheFunction - The function for which we are holding slot numbers.
private bool FunctionProcessed = false
private bool ShouldInitializeAllMetadata
private std::function<void(AbstractSlotTrackerStorage*, const Module*, bool)> ProcessModuleHookFn
private std::function<void(AbstractSlotTrackerStorage*, const Function*, bool)> ProcessFunctionHookFn
private const llvm::ModuleSummaryIndex* TheIndex = nullptr
The summary index for which we are holding slot numbers.
private llvm::SlotTracker::ValueMap mMap
mMap - The slot map for the module level data.
private unsigned int mNext = 0
private llvm::SlotTracker::ValueMap fMap
fMap - The slot map for the function level data.
private unsigned int fNext = 0
private DenseMap<const llvm::MDNode*, unsigned int> mdnMap
mdnMap - Map for MDNodes.
private unsigned int mdnNext = 0
private DenseMap<llvm::AttributeSet, unsigned int> asMap
asMap - The slot map for attribute sets.
private unsigned int asNext = 0
private StringMap<unsigned int> ModulePathMap
ModulePathMap - The slot map for Module paths used in the summary index.
private unsigned int ModulePathNext = 0
private DenseMap<GlobalValue::GUID, unsigned int> GUIDMap
GUIDMap - The slot map for GUIDs used in the summary index.
private unsigned int GUIDNext = 0
private StringMap<unsigned int> TypeIdMap
TypeIdMap - The slot map for type ids used in the summary index.
private unsigned int TypeIdNext = 0

Method Overview

Inherited from AbstractSlotTrackerStorage:

Methods

void CreateAttributeSetSlot(llvm::AttributeSet AS)

Description

Insert the specified AttributeSet into the slot table.

Declared at: llvm/lib/IR/AsmWriter.cpp:799

Parameters

llvm::AttributeSet AS

void CreateFunctionSlot(const llvm::Value* V)

Description

CreateFunctionSlot - Insert the specified Value* into the slot table.

Declared at: llvm/lib/IR/AsmWriter.cpp:796

Parameters

const llvm::Value* V

void CreateGUIDSlot(GlobalValue::GUID GUID)

Description

Create a new slot for the specified GUID

Declared at: llvm/lib/IR/AsmWriter.cpp:802

Parameters

GlobalValue::GUID GUID

void CreateMetadataSlot(const llvm::MDNode* N)

Description

CreateMetadataSlot - Insert the specified MDNode* into the slot table.

Declared at: llvm/lib/IR/AsmWriter.cpp:793

Parameters

const llvm::MDNode* N

inline void CreateModulePathSlot(
    llvm::StringRef Path)

Description

Create a new slot for the specified Module

Declared at: llvm/lib/IR/AsmWriter.cpp:801

Parameters

llvm::StringRef Path

void CreateModuleSlot(const llvm::GlobalValue* V)

Description

CreateModuleSlot - Insert the specified GlobalValue* into the slot table.

Declared at: llvm/lib/IR/AsmWriter.cpp:790

Parameters

const llvm::GlobalValue* V

void CreateTypeIdSlot(llvm::StringRef Id)

Description

Create a new slot for the specified Id

Declared at: llvm/lib/IR/AsmWriter.cpp:803

Parameters

llvm::StringRef Id

SlotTracker(
    const llvm::Function* F,
    bool ShouldInitializeAllMetadata = false)

Description

Construct from a function, starting out in incorp state. If \c 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).

Declared at: llvm/lib/IR/AsmWriter.cpp:720

Parameters

const llvm::Function* F
bool ShouldInitializeAllMetadata = false

SlotTracker(
    const llvm::Module* M,
    bool ShouldInitializeAllMetadata = false)

Description

Construct from a module. If \c 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).

Declared at: llvm/lib/IR/AsmWriter.cpp:712

Parameters

const llvm::Module* M
bool ShouldInitializeAllMetadata = false

SlotTracker(const llvm::ModuleSummaryIndex* Index)

Description

Construct from a module summary index.

Declared at: llvm/lib/IR/AsmWriter.cpp:724

Parameters

const llvm::ModuleSummaryIndex* Index

SlotTracker(const llvm::SlotTracker&)

Declared at: llvm/lib/IR/AsmWriter.cpp:726

Parameters

const llvm::SlotTracker&

llvm::SlotTracker::as_iterator as_begin()

Declared at: llvm/lib/IR/AsmWriter.cpp:775

bool as_empty() const

Declared at: llvm/lib/IR/AsmWriter.cpp:778

llvm::SlotTracker::as_iterator as_end()

Declared at: llvm/lib/IR/AsmWriter.cpp:776

unsigned int as_size() const

Declared at: llvm/lib/IR/AsmWriter.cpp:777

void createMetadataSlot(const llvm::MDNode* N)

Description

getMetadataSlot - Get the slot number of a MDNode.

Declared at: llvm/lib/IR/AsmWriter.cpp:738

Parameters

const llvm::MDNode* N

int getAttributeGroupSlot(llvm::AttributeSet AS)

Declared at: llvm/lib/IR/AsmWriter.cpp:745

Parameters

llvm::AttributeSet AS

const llvm::Function* getFunction() const

Declared at: llvm/lib/IR/AsmWriter.cpp:757

int getGUIDSlot(GlobalValue::GUID GUID)

Declared at: llvm/lib/IR/AsmWriter.cpp:747

Parameters

GlobalValue::GUID GUID

int getGlobalSlot(const llvm::GlobalValue* V)

Description

getGlobalSlot - Get the slot number of a global value.

Declared at: llvm/lib/IR/AsmWriter.cpp:743

Parameters

const llvm::GlobalValue* V

int getLocalSlot(const llvm::Value* V)

Description

Return the slot number of the specified value in it's type plane. If something is not in the SlotTracker, return -1.

Declared at: llvm/lib/IR/AsmWriter.cpp:742

Parameters

const llvm::Value* V

int getMetadataSlot(const llvm::MDNode* N)

Description

getMetadataSlot - Get the slot number of a MDNode.

Declared at: llvm/lib/IR/AsmWriter.cpp:744

Parameters

const llvm::MDNode* N

int getModulePathSlot(llvm::StringRef Path)

Declared at: llvm/lib/IR/AsmWriter.cpp:746

Parameters

llvm::StringRef Path

unsigned int getNextMetadataSlot()

Declared at: llvm/lib/IR/AsmWriter.cpp:736

int getTypeIdSlot(llvm::StringRef Id)

Declared at: llvm/lib/IR/AsmWriter.cpp:748

Parameters

llvm::StringRef Id

void incorporateFunction(const llvm::Function* F)

Description

If you'd like to deal with a function instead of just a module, use this method to get its data into the SlotTracker.

Declared at: llvm/lib/IR/AsmWriter.cpp:752

Parameters

const llvm::Function* F

inline void initializeIfNeeded()

Description

These functions do the actual initialization.

Declared at: llvm/lib/IR/AsmWriter.cpp:784

int initializeIndexIfNeeded()

Declared at: llvm/lib/IR/AsmWriter.cpp:785

llvm::SlotTracker::mdn_iterator mdn_begin()

Declared at: llvm/lib/IR/AsmWriter.cpp:767

bool mdn_empty() const

Declared at: llvm/lib/IR/AsmWriter.cpp:770

llvm::SlotTracker::mdn_iterator mdn_end()

Declared at: llvm/lib/IR/AsmWriter.cpp:768

unsigned int mdn_size() const

Declared at: llvm/lib/IR/AsmWriter.cpp:769

void processFunction()

Description

Add all of the functions arguments, basic blocks, and instructions.

Declared at: llvm/lib/IR/AsmWriter.cpp:812

void processFunctionMetadata(
    const llvm::Function& F)

Description

Add all of the metadata from a function.

Declared at: llvm/lib/IR/AsmWriter.cpp:818

Parameters

const llvm::Function& F

void processGlobalObjectMetadata(
    const llvm::GlobalObject& GO)

Description

Add the metadata directly attached to a GlobalObject.

Declared at: llvm/lib/IR/AsmWriter.cpp:815

Parameters

const llvm::GlobalObject& GO

int processIndex()

Declared at: llvm/lib/IR/AsmWriter.cpp:809

void processInstructionMetadata(
    const llvm::Instruction& I)

Description

Add all of the metadata from an instruction.

Declared at: llvm/lib/IR/AsmWriter.cpp:821

Parameters

const llvm::Instruction& I

void processModule()

Description

Add all of the module level global variables (and their initializers) and function declarations, but not the contents of those functions.

Declared at: llvm/lib/IR/AsmWriter.cpp:807

void purgeFunction()

Description

After calling incorporateFunction, use this method to remove the most recently incorporated function from the SlotTracker. This will reset the state of the machine back to just the module contents.

Declared at: llvm/lib/IR/AsmWriter.cpp:762

void setProcessHook(
    std::function<
        void(AbstractSlotTrackerStorage*,
             const Function*,
             bool)>)

Declared at: llvm/lib/IR/AsmWriter.cpp:733

Parameters

std::function<void(AbstractSlotTrackerStorage*, const Function*, bool)>

void setProcessHook(
    std::function<
        void(AbstractSlotTrackerStorage*,
             const Module*,
             bool)>)

Declared at: llvm/lib/IR/AsmWriter.cpp:731

Parameters

std::function<void(AbstractSlotTrackerStorage*, const Module*, bool)>

~SlotTracker()

Declared at: llvm/lib/IR/AsmWriter.cpp:729