Equivalence Class ReferenceFORTRAN Equivalence class.
More...
#include <Equivalence.h>
Inheritance diagram for Equivalence:
[legend]List of all members.
|
Public Member Functions |
| | Equivalence (const char *name) |
| | class Equivalence inlines
|
| | Equivalence (const char *name, const BinRep &binstr, const Symtab &symtab) |
| | Constructor from binstr.
|
| | Equivalence (const Equivalence &other) |
| Equivalence & | operator= (const Equivalence &other) |
| | ~Equivalence () |
| const char * | name_ref () const |
| BinRep * | overflow_ref () const |
| int | size () const |
| | Returns the size of the entire equivalence class.
|
| int | entries () const |
| | Returns the number of equivalence members in this object.
|
| Iterator< EquivalenceMember > | iterator () const |
| | Returns an iterator for the EquivalenceMember's of this equivalence class.
|
| EquivalenceMember * | find_ref (const Symbol &sym) |
| | Returns a pointer to the EquivalenceMember (or 0 if none) which contains the Symbol 'sym'.
|
| void | del (Symbol &symbol) |
| | Delete a variable reference from the members list -- this change is also automatically reflected in symbol by making the variable's equivalence field point to NULL.
|
| void | clear () |
| | Delete all variables from the members list, updating the symbols' equivalence field to NULL in the process.
|
| void | ins (Symbol &symbol, int byte_base) |
| | Insert a variable into the members list -- this change is also automatically reflected in symbol by making the variable's equivalence field point to this structure If the variable is already in another equivalence, then an error occurs, since this is likely a mistake.
|
| virtual void | print (ostream &o) const |
| | Write to stream in debug format (or use operator<< ).
|
| virtual void | write (ostream &o, int space_for_label, int max_line_len, const Symtab &symtab) |
| | Write to stream in Fortran format.
|
| virtual Definition * | definition_clone () const |
| virtual int | structures_OK () const |
| | Check the structure of the data for errors or inconsistency Return 0 and print error message if problems found, otherwise return 1 without message.
|
| virtual void | relink_dptrs (ProgramUnit &p) |
| | Change the pointers found in an Equivalence element to be pointers into the given ProgramUnit.
|
Protected Member Functions |
| Expression * | _equiv_array_offset (const Symtab &symtab, EquivalenceMember &eq, int delta) const |
Friends |
| class | FunctionSymbol |
| class | VariableSymbol |
| class | EquivalenceDict |
Detailed Description
FORTRAN Equivalence class.
Polaris C++ VDL - See also:
- Equivalence.h
Equivalence.h
Equivalence is a representation of a FORTRAN equivalence class, containing a set of members (with a byte-base indicating the byte in the equivalence class at which that variable starts) and a length or size.
A word of explanation is in order here. In FORTRAN, it is possible to have the same variable in more than one equivalence class. In this data structure, however, any particular symbol is allowed in no more than one equivalence class. The scanner automatically converts the multi format to the uni format, so the user need only be aware of this fact if he/she is trying to insert a symbol into an Equivalence.
Perhaps the destructor for the Equivalence class should automatically call del() on each of its members so that the pointers in the Symtab are all set to null when this is deleted.
Definition at line 94 of file Equivalence.h.
Constructor & Destructor Documentation
| Equivalence::Equivalence |
( |
const char * |
name |
) |
|
|
| Equivalence::Equivalence |
( |
const char * |
name, |
|
|
const BinRep & |
binstr, |
|
|
const Symtab & |
symtab |
|
) |
|
|
|
|
Constructor from binstr.
... Here we expect a set of tuples of [variable name, byte base]
... Unrecognized -- add to overflow
Definition at line 76 of file Equivalence.cc.
References BinRep::find_ref(), BinRep::ins(), List< T >::ins_first(), BinRep::is_set(), BinRep::put_set(), register_instance(), BinRep::to_integer(), BinRep::to_set(), BinRep::to_string(), and warn_overflow_map(). |
Member Function Documentation
| const char * Equivalence::name_ref |
( |
|
) |
const |
|
| BinRep * Equivalence::overflow_ref |
( |
|
) |
const |
|
| int Equivalence::size |
( |
|
) |
const |
|
| int Equivalence::entries |
( |
|
) |
const |
|
|
|
Returns an iterator for the EquivalenceMember's of this equivalence class.
Definition at line 563 of file Equivalence.cc. |
| void Equivalence::del |
( |
Symbol & |
symbol |
) |
|
|
| void Equivalence::clear |
( |
|
) |
|
|
| void Equivalence::ins |
( |
Symbol & |
symbol, |
|
|
int |
byte_base |
|
) |
|
|
|
|
Insert a variable into the members list -- this change is also automatically reflected in symbol by making the variable's equivalence field point to this structure If the variable is already in another equivalence, then an error occurs, since this is likely a mistake.
(In FORTRAN, this would be legal, but in Polaris, this is not allowed, since it is always possible to combine Equivalence's with overlapping members.
Definition at line 177 of file Equivalence.cc.
References Symbol::equivalence(), Symbol::equivalence_ref(), Symbol::size(), and symbol().
Referenced by move_saved_vars(), and rename_equivalence_to_match(). |
| void Equivalence::print |
( |
ostream & |
o |
) |
const [virtual] |
|
|
|
Write to stream in debug format (or use operator<< ).
... _size field
... _members field
... _overflow field
Implements Definition.
Definition at line 200 of file Equivalence.cc. |
| void Equivalence::write |
( |
ostream & |
o, |
|
|
int |
space_for_label, |
|
|
int |
max_line_len, |
|
|
const Symtab & |
symtab |
|
) |
[virtual] |
|
|
|
Write to stream in Fortran format.
... Don't bother -- no members of this equivalence class exist
... Initially we need to process all of the members of the equivalence class.
... Make an equivalence statement covering all the members of ... this equivalence subclass.
... Form the union of all the EQUIVALENCE subclasses.
... Start with the minimum offset in the class.
... Join all of the subclasses into the existing region.
... Find a member we have not already used which overlaps with the ... existing region.
Definition at line 265 of file Equivalence.cc.
References _equiv_array_offset(), EquivalenceMember::byte_base(), convert_case(), Iterator< T >::current(), Iterator< T >::current_valid(), RefList< T >::entries(), False, ProtoDatabase< S, T >::find_ref(), TypedBaseMap< S, T >::first_ref(), RefList< T >::grab(), Database< S, T >::grab(), Database< S, T >::ins(), RefList< T >::ins_last(), Symbol::name_ref(), Iterator< T >::reset(), Symbol::size(), Declaration::str_ref(), EquivalenceMember::symbol(), True, RefList< T >::valid(), and Iterator< T >::valid(). |
| Definition * Equivalence::definition_clone |
( |
|
) |
const [virtual] |
|
| int Equivalence::structures_OK |
( |
|
) |
const [virtual] |
|
|
|
Check the structure of the data for errors or inconsistency Return 0 and print error message if problems found, otherwise return 1 without message.
Implements Definition.
Definition at line 435 of file Equivalence.cc. |
| void Equivalence::relink_dptrs |
( |
ProgramUnit & |
p |
) |
[virtual] |
|
Friends And Related Function Documentation
The documentation for this class was generated from the following files:
|