#include "common/system_specific.h"
#include "symbol_utils.h"
#include "type_utils.h"
#include "iokernel/cast.h"
#include "basicnodes/basic.h"
#include "basicnodes/basic_factory.h"
#include "suifnodes/suif_factory.h"
#include "suifnodes/suif.h"
#include "iokernel/object_factory.h"
#include "iokernel/meta_class.h"
#include "iokernel/pointer_meta_class.h"
#include "suifkernel/utilities.h"
#include "dcast.h"
Functions | |
bool | is_external_symbol_table (SymbolTable *the_table) |
This function returns TRUE if the Symbol Table is the external_symbol_table. | |
bool | is_statically_allocated (Symbol *the_symbol) |
SymbolTable* | find_scoped_object_scope (const ScopedObject *the_obj) |
Return the nearest enclosing Symbol table of a Scoped Object or NULL if there is no such Symbol table. | |
SymbolTable* | find_child_scoping_this (const ScopedObject *the_szot) |
SymbolTable* | find_implicit_follow_up (const ScopedObject *the_szot) |
SymbolTable* | find_implicit_super_scope (const SymbolTable *table) |
SymbolTable* | find_super_scope (const SymbolTable *scope) |
Returns the scope containing the symbol table or NULL if there is none. More... | |
bool | is_in_scope (const VariableSymbol* var, const SuifObject* obj) |
SymbolTable* | find_scope (const SuifObject *the_zot) |
Return the nearest enclosing Symbol table of a suif object, or NULL if there is no such Symbol table. | |
VariableSymbol* | lookup_var (SymbolTable *scope, String name) |
The following four functions are used to lookup variable symbols by name. More... | |
VariableSymbol* | lookup_var_locally (SymbolTable *scope, String name) |
list<VariableSymbol *>* | multi_lookup_var (SymbolTable *scope, String name) |
list<VariableSymbol *>* | multi_lookup_var_locally (SymbolTable *scope, String name) |
ProcedureSymbol* | lookup_proc (SymbolTable *scope, String name) |
The following four functions are completely analagous to the last four except that they apply to procedure symbols instead of variable symbols. | |
ProcedureSymbol* | lookup_proc_locally (SymbolTable *scope, String name) |
list<ProcedureSymbol *>* | multi_lookup_proc (SymbolTable *scope, String name) |
list<ProcedureSymbol *>* | multi_lookup_proc_locally (SymbolTable *scope, String name) |
CodeLabelSymbol* | lookup_code_label (SymbolTable *scope, String name) |
CodeLabelSymbol* | lookup_code_label_locally (SymbolTable *scope, String name) |
list<CodeLabelSymbol *>* | multi_lookup_code_label (SymbolTable *scope, String name) |
list<CodeLabelSymbol *>* | multi_lookup_code_label_locally ( SymbolTable *scope, String name) |
VariableSymbol* | new_unique_variable (SuifEnv *s, SuifObject *scope_finder, QualifiedType *the_type) |
These two functions each return a new unique variable Symbol that is installed in the nearest enclosing Symbol table of scope_finder. More... | |
VariableSymbol* | new_unique_variable (SuifEnv *s, SuifObject *scope_finder, QualifiedType *the_type, String base_name) |
VariableSymbol* | new_anonymous_variable (SuifEnv *s, SuifObject *scope_finder, QualifiedType *the_type) |
Create a new anonymous variable. More... | |
VariableSymbol* | new_anonymous_variable (SuifEnv *s, SymbolTable *st, QualifiedType *the_type) |
Create a new anonymous variable. More... | |
CodeLabelSymbol* | new_unique_label (SuifEnv *s, SuifObject *scope_finder) |
These two functions each return a new unique code label Symbol that is installed in the nearest enclosing Symbol table of scope_finder. More... | |
CodeLabelSymbol* | new_unique_label (SuifEnv *s, SuifObject *scope_finder, String base_name) |
CodeLabelSymbol* | new_anonymous_label (SymbolTable *scope) |
CodeLabelSymbol* | new_anonymous_label (SuifEnv *s, SuifObject *scope_finder) |
LoadVariableExpression* | create_var_use (VariableSymbol *var) |
create a LoadVariableExpression with the right type in the same suifenv. | |
void | rename_symbol (SymbolTableObject *sym, const LString &name) |
Change the name of a symbol If the symbol is renamed to an emptyLString the symbol will be removed from the lookup table and an annotation "orig_name" will be placed on the symbol so that the symmbol naming pass can make up a readable derivative name. | |
bool | is_definition_symbol (Symbol* sym) |
Return true if sym is a VariableSymbol or ProcedureSymbol and has a definition. | |
DefinitionBlock* | get_corresponding_definition_block (SymbolTable *st) |
Find the definition block corresponding to a given symbol table. |
|
create a LoadVariableExpression with the right type in the same suifenv.
|
|
|
|
Return the nearest enclosing Symbol table of a suif object, or NULL if there is no such Symbol table.
|
Return the nearest enclosing Symbol table of a Scoped Object or NULL if there is no such Symbol table.
|
Returns the scope containing the symbol table or NULL if there is none.
This is a replacement for the symbol_table::super_scope() method
|
Find the definition block corresponding to a given symbol table.
|
Return true if sym is a VariableSymbol or ProcedureSymbol and has a definition.
|
This function returns TRUE if the Symbol Table is the external_symbol_table.
|
|
|
|
|
The following four functions are completely analagous to the last four except that they apply to procedure symbols instead of variable symbols.
|
|
The following four functions are used to lookup variable symbols by name.
The first two are designed for convenience when only one match is expected. if there is more than one match, only the first match will be returned. The lookup_var() function looks in the specified scope and then if the name is not found continues with enclosing scopes until there are no more enclosing scopes. If no match is found, NULL is returned. The lookup_var_locally() function is the same except that it only looks in the specified scope, not in any enclosing scopes. The other two functions, the ones beginning with ``multi_'' return a (possibly empty) list of all matches found, but are otherwise the same as the first two functions.
|
|
|
|
|
|
|
|
|
|
Create a new anonymous variable.
Use this for temporary variables. Naming will be done later to avoid symbol name clashes
|
Create a new anonymous variable.
Use this for temporary variables. Naming will be done later to avoid symbol name clashes
|
|
These two functions each return a new unique code label Symbol that is installed in the nearest enclosing Symbol table of scope_finder.
If scope_finder is not in a scope, NULL is returned. The first version makes up a name for the label by itself and the second uses the base_name provided plus some decimal digits. See comments for new_unique_variable. Use new_anonymous_label instead in new code.
|
|
These two functions each return a new unique variable Symbol that is installed in the nearest enclosing Symbol table of scope_finder.
If scope_finder is not in a scope, NULL is returned. The first version makes up a name for the variable by itself and the second uses the base_name provided plus some decimal digits.
\warning. This is slow and naming is done in the wrong place. Avoid using these in new code. Variables without good names should be created with no identifier. A pass will then give them unique names later which are guaranteed not to clash.
|
Change the name of a symbol If the symbol is renamed to an emptyLString the symbol will be removed from the lookup table and an annotation "orig_name" will be placed on the symbol so that the symmbol naming pass can make up a readable derivative name.