Symbols are used as handles for variables, procedures, and potential targets of branches and jumps.
abstract Symbol : SymbolTableObject
{
virtual Type * reference symbol_type;
bool is_address_taken;
};
| symbol_type | type of the symbol. |
| is_address_taken | whether or not the address of the symbol is taken. Most of the time most symbols are never addressed, which facilitates optimizations and analysis of code referring to those symbols. |
concrete VariableSymbol : Symbol
{
QualifiedType* reference type in symbol_type;
VariableDefinition * reference definition omitted;
};
| type | Type of the variable |
| definition | Initialization for variable. The initalization may be static or not as defined by the is_static field on the definition. A statically allocated variable does not have a definition if it is in the external scope and it refers to a variable defined outside the current file set that will be linked in later. A VariableSymbol at file or global scope in Standard SUIF is assumed to be statically allocated. A VariableSymbol at procedure scope or block scope within a procedure is assumed to be an auto variable unless it has a VariableDefinition and that definition has the is_static field set, in which case it is statically allocated. |
concrete FieldSymbol : VariableSymbol
{
Expression * owner bit_offset;
};
| bit_offset | Specifies how far into the GroupType the field begins. |
concrete NestingVariableSymbol : VariableSymbol
{
NestingVariableSymbol * reference super_variable;
Expression * owner bit_offset;
list<NestingVariableSymbol *reference> child_variables;
};
| super_variable | shows which variable is the parent, if any |
| bit_offset | shows how far past the start of the parent the sub-variable starts. |
| child_variables | list of its children variables |
concrete ParameterSymbol : VariableSymbol {};
concrete ProcedureSymbol : Symbol
{
ProcedureType* reference type in symbol_type;
ProcedureDefinition * reference definition optional;
};
| type | Type of the procedure |
| definition | Definition of procedure. This is optional. |
concrete CodeLabelSymbol : Symbol
{
LabelType* reference type in symbol_type;
};
| type | Type of the label |