|
LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
Root for Named or anonymous (fresh) identifiers. More...
#include <identifier.hh>

Public Types | |
| typedef Identifier< Traits_ > | self_type |
| typedef boost::variant < unsigned, misc::symbol > | value_type |
| Type of the ``content'' of the identifier. | |
| typedef misc::endo_map < Identifier > | map_type |
| Identifier filter type. | |
Public Member Functions | |
| Identifier () | |
| Identifier (const misc::symbol &sym) | |
| Identifier (const std::string &str) | |
| Identifier (const char *str) | |
| Identifier (const self_type &id) | |
| std::ostream & | dump (std::ostream &) const |
| std::string | string_get () const |
| Same as dump, but return a string. | |
| const value_type & | value_get () const |
| const std::string & | prefix_get () const |
| int | rank_get () const |
| self_type & | operator= (const self_type &rhs) |
| bool | operator== (const self_type &rhs) const |
| bool | operator!= (const self_type &rhs) const |
| bool | operator< (const self_type &rhs) const |
| bool | operator<= (const self_type &rhs) const |
| bool | operator> (const self_type &rhs) const |
| bool | operator>= (const self_type &rhs) const |
Static Public Attributes | |
| static const misc::xalloc < map_type * > | map |
| Filtering identifier outputs. | |
Private Member Functions | |
| template<> | |
| unsigned | count_ |
| template<> | |
| unsigned | count_ |
| template<> | |
| unsigned | count_ |
| template<> | |
| unsigned | count_ |
Private Attributes | |
| value_type | value_ |
| const std::string * | prefix_ |
| int | rank_ |
Static Private Attributes | |
| static unsigned | count_ |
| Unique counter for this kind of identifier. | |
Root for Named or anonymous (fresh) identifiers.
It is used to factor the implementation of temp::Temp and temp::Label.
| Traits | a traits that should have two members: the string prefix and the integer rank. |
This class template makes it possible to instantiate several natures of identifiers, say identifiers tagged with an int, a misc::symbol, and so forth. Identifiers uses a boost::variant to store its actual value. Currently, this variant can hold an unsigned or a misc::symbol.
We need a total order on Identifier, so first we need a comparison on identifier of same value type (i.e., an order on int, an order on misc::symbol etc.), but we also need an order between identifiers of different kinds: int versus misc::symbol etc.
To implement this, Traits<Tag_>::rank must return a unique int which will serve to compare heterogeneous identifiers. For instance if
then a numbered Identifier will be sorted before a named Identifier.
We also need to know how to print an Identifier. For instance, numbered temporaries are reported as t42, while the temp named $fp is to be printed as is. The value of Traits_<Tag_ >::prefix will be printed before the value of the tag itself. Hence, to print t42, specify
| typedef misc::endo_map<Identifier> temp::Identifier< Traits_ >::map_type |
Identifier filter type.
| typedef Identifier<Traits_> temp::Identifier< Traits_ >::self_type |
| typedef boost::variant<unsigned, misc::symbol> temp::Identifier< Traits_ >::value_type |
Type of the ``content'' of the identifier.
| temp::Identifier< Traits_ >::Identifier | ( | ) |
References temp::Identifier< Traits_ >::count_().
| temp::Identifier< Traits_ >::Identifier | ( | const misc::symbol & | sym | ) |
| temp::Identifier< Traits_ >::Identifier | ( | const std::string & | str | ) |
| temp::Identifier< Traits_ >::Identifier | ( | const char * | str | ) |
| temp::Identifier< Traits_ >::Identifier | ( | const self_type & | id | ) |
|
private |
Referenced by temp::Identifier< Traits_ >::Identifier().
|
private |
|
private |
|
private |
| std::ostream& temp::Identifier< Traits_ >::dump | ( | std::ostream & | ) | const |
| bool temp::Identifier< Traits_ >::operator!= | ( | const self_type & | rhs | ) | const |
| bool temp::Identifier< Traits_ >::operator< | ( | const self_type & | rhs | ) | const |
| bool temp::Identifier< Traits_ >::operator<= | ( | const self_type & | rhs | ) | const |
| self_type& temp::Identifier< Traits_ >::operator= | ( | const self_type & | rhs | ) |
| bool temp::Identifier< Traits_ >::operator== | ( | const self_type & | rhs | ) | const |
| bool temp::Identifier< Traits_ >::operator> | ( | const self_type & | rhs | ) | const |
| bool temp::Identifier< Traits_ >::operator>= | ( | const self_type & | rhs | ) | const |
| const std::string& temp::Identifier< Traits_ >::prefix_get | ( | ) | const |
Referenced by target::mips::Cpu::Cpu().
| int temp::Identifier< Traits_ >::rank_get | ( | ) | const |
| std::string temp::Identifier< Traits_ >::string_get | ( | ) | const |
Same as dump, but return a string.
Referenced by target::mips::SpimAssembly::call_build(), target::ia32::GasAssembly::call_build(), assem::ProcFrag::file_name(), target::Codegen::fragment_entry_exit_build(), target::ia32::GasAssembly::label_build(), target::mips::SpimAssembly::label_build(), and target::ia32::GasLayout::operator()().
| const value_type& temp::Identifier< Traits_ >::value_get | ( | ) | const |
Referenced by target::mips::Cpu::Cpu().
|
staticprivate |
Unique counter for this kind of identifier.
|
static |
Filtering identifier outputs.
Referenced by target::instructions_dump(), liveness::liveness_dump(), regalloc::RegisterAllocator::operator()(), and temp::operator<<().
|
private |
|
private |
|
private |