LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

llvm::SlotTable Class Reference

Abstract data type for slot numbers. More...

#include <SlotTable.h>

Collaboration diagram for llvm::SlotTable:

Collaboration graph
[legend]
List of all members.

Public Types

Types
typedef unsigned SlotNum
 Type slot number identification type.
typedef unsigned PlaneNum
 The type of a plane number (corresponds to Type::TypeID).
typedef std::vector< const
Value * > 
ValuePlane
 A single plane of Values. Intended index is slot number.
typedef std::vector< ValuePlaneValueTable
 A table of Values. Intended index is Type::TypeID.
typedef std::map< const Value *,
SlotNum
ValueMap
 A map of values to slot numbers.
typedef std::vector< const
Type * > 
TypePlane
 A single plane of Types. Intended index is slot number.
typedef std::map< const Type *,
SlotNum
TypeMap
 A map of types to slot numbers.
enum  Constants { MAX_SLOT = 4294967294U, BAD_SLOT = 4294967295U }
 Some constants used as flags instead of actual slot numbers. More...

Public Member Functions

Constructors
 SlotTable (bool dont_insert_primitives=false)
 Default Constructor.
Accessors
size_t value_size () const
 Get the number of planes of values.
size_t type_size () const
 Get the number of types.
bool plane_exists (PlaneNum plane) const
 Determine if a specific type plane in the value table exists.
bool plane_empty (PlaneNum plane) const
 Determine if a specific type plane in the value table is empty.
size_t plane_size (PlaneNum plane) const
 Get the number of entries in a specific plane of the value table.
bool empty () const
 Determine if the SlotTable is empty.
SlotNum getSlot (const Value *Val) const
 Get a slot number for a Value.
SlotNum getSlot (const Type *Typ) const
 Get a slot number for a Type.
bool hasSlot (const Value *Val)
 Determine if a Value has a slot number.
bool hasSlot (const Type *Typ)
 Determine if a Type has a slot number.
Mutators
void clear ()
 Completely clear the SlotTable;.
void resize (size_t new_size)
 Resize the table to incorporate at least new_size planes.
SlotNum insert (const Value *Val, PlaneNum plane)
 Add a Value to the SlotTable.
SlotNum insert (const Type *Typ)
 Add a Type to the SlotTable.
SlotNum remove (const Value *Val, PlaneNum plane)
 Remove a Value from the SlotTable.
SlotNum remove (const Type *Typ)
 Remove a Type from the SlotTable.

Detailed Description

Abstract data type for slot numbers.

This class is the common abstract data type for both the SlotMachine and the SlotCalculator. It provides the two-way mapping between Values and Slots as well as the two-way mapping between Types and Slots. For Values, the slot number can be extracted by simply using the getSlot() method and passing in the Value. For Types, it is the same.

Definition at line 36 of file SlotTable.h.


Member Typedef Documentation

typedef unsigned llvm::SlotTable::PlaneNum
 

The type of a plane number (corresponds to Type::TypeID).

This type is used throughout the code to make it clear that an unsigned value refers to a type plane number and not something else.

Definition at line 50 of file SlotTable.h.

typedef unsigned llvm::SlotTable::SlotNum
 

Type slot number identification type.

This type is used throughout the code to make it clear that an unsigned value refers to a Slot number and not something else.

Definition at line 45 of file SlotTable.h.

typedef std::map<const Type*,SlotNum> llvm::SlotTable::TypeMap
 

A map of types to slot numbers.

Definition at line 71 of file SlotTable.h.

typedef std::vector<const Type*> llvm::SlotTable::TypePlane
 

A single plane of Types. Intended index is slot number.

Definition at line 68 of file SlotTable.h.

typedef std::map<const Value*,SlotNum> llvm::SlotTable::ValueMap
 

A map of values to slot numbers.

Definition at line 65 of file SlotTable.h.

typedef std::vector<const Value*> llvm::SlotTable::ValuePlane
 

A single plane of Values. Intended index is slot number.

Definition at line 59 of file SlotTable.h.

typedef std::vector<ValuePlane> llvm::SlotTable::ValueTable
 

A table of Values. Intended index is Type::TypeID.

Definition at line 62 of file SlotTable.h.


Member Enumeration Documentation

enum llvm::SlotTable::Constants
 

Some constants used as flags instead of actual slot numbers.

Enumerator:
MAX_SLOT 
BAD_SLOT 

Definition at line 53 of file SlotTable.h.


Constructor & Destructor Documentation

llvm::SlotTable::SlotTable bool  dont_insert_primitives = false  )  [explicit]
 

Default Constructor.

This constructor initializes all the containers in the SlotTable to empty and then inserts all the primitive types into the type plane by default. This is done as a convenience since most uses of the SlotTable will need the primitive types. If you don't need them, pass in true.

Parameters:
dont_insert_primitives  Control insertion of primitives.


Member Function Documentation

void llvm::SlotTable::clear  ) 
 

Completely clear the SlotTable;.

bool llvm::SlotTable::empty  )  const
 

Determine if the SlotTable is empty.

Returns:
true if the slot table is completely empty.

Referenced by plane_empty().

SlotNum llvm::SlotTable::getSlot const Type Typ  )  const
 

Get a slot number for a Type.

Returns:
the slot number or BAD_SLOT if Type is not in the table.

SlotNum llvm::SlotTable::getSlot const Value Val  )  const
 

Get a slot number for a Value.

Returns:
the slot number or BAD_SLOT if Val is not in table.

Referenced by hasSlot().

bool llvm::SlotTable::hasSlot const Type Typ  )  [inline]
 

Determine if a Type has a slot number.

Returns:
true iff the Type is in the table.

Definition at line 130 of file SlotTable.h.

References BAD_SLOT, and getSlot().

bool llvm::SlotTable::hasSlot const Value Val  )  [inline]
 

Determine if a Value has a slot number.

Returns:
true iff the Value is in the table.

Definition at line 126 of file SlotTable.h.

References BAD_SLOT, and getSlot().

SlotNum llvm::SlotTable::insert const Type Typ  ) 
 

Add a Type to the SlotTable.

Returns:
the slot number of the newly inserted type

SlotNum llvm::SlotTable::insert const Value Val,
PlaneNum  plane
 

Add a Value to the SlotTable.

Returns:
the slot number of the newly inserted value in its plane

bool llvm::SlotTable::plane_empty PlaneNum  plane  )  const [inline]
 

Determine if a specific type plane in the value table is empty.

Definition at line 103 of file SlotTable.h.

References empty(), and plane_exists().

bool llvm::SlotTable::plane_exists PlaneNum  plane  )  const [inline]
 

Determine if a specific type plane in the value table exists.

Definition at line 98 of file SlotTable.h.

Referenced by plane_empty(), and plane_size().

size_t llvm::SlotTable::plane_size PlaneNum  plane  )  const [inline]
 

Get the number of entries in a specific plane of the value table.

Definition at line 108 of file SlotTable.h.

References plane_exists().

SlotNum llvm::SlotTable::remove const Type Typ  ) 
 

Remove a Type from the SlotTable.

Returns:
the slot number that Typ had when it was in the table

SlotNum llvm::SlotTable::remove const Value Val,
PlaneNum  plane
 

Remove a Value from the SlotTable.

Returns:
the slot number that Val had when it was in the table

void llvm::SlotTable::resize size_t  new_size  ) 
 

Resize the table to incorporate at least new_size planes.

size_t llvm::SlotTable::type_size  )  const [inline]
 

Get the number of types.

Definition at line 95 of file SlotTable.h.

size_t llvm::SlotTable::value_size  )  const [inline]
 

Get the number of planes of values.

Definition at line 92 of file SlotTable.h.


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