parrotcode: compilers/imcc/symreg.c | |
Contents | Compilers |
compilers/imcc/symreg.c
imcc symbol handling
XXX: SymReg stuff has become overused. SymReg should be for symbolic registers, reg allocation, etc. but we are now using it for extensive symbol table management. Need to convert much of this over the use Symbol and SymbolTable (see symbol.h and symbol.c)
void push_namespace
void pop_namespace
static SymReg *_get_sym_typed
static SymReg *_mk_symreg
SymReg *mk_symreg
char *symreg_to_str
SymReg *mk_temp_reg
SymReg *mk_pcc_sub
void add_namespace
void add_pcc_arg
void add_pcc_param
void add_pcc_result
void add_pcc_multi
void add_pcc_return
void add_pcc_sub
void add_pcc_cc
SymReg *mk_pasm_reg
static char *_mk_fullname
::
.
If there's no namespace,
the name is returned on its own.SymReg *mk_ident
SymReg *mk_ident_ur
static SymReg *mk_pmc_const_2
SymReg *mk_const_ident
SymReg *_mk_const
SymReg *mk_const
static char *add_ns
SymReg *_mk_address
SymReg *mk_sub_label
SymReg *mk_sub_address
SymReg *mk_local_label
SymReg *mk_label_address
SymReg *dup_sym
"key" ';' "key" _kc -> (list of above) yes
"key" ';' $I0 _kc VTREGKEY -> (list of above) yes
The information about which reg should be passed to build_key() is
in the instruction.
A key containing a variable has a special flag VTREGKEY
because this key must be considered for life analysis for
all the chain members, that are variables.
An instruction with a keychain looks like this
e.h. set I0, P["abc";0;I1]
ins->r[2] = keychain 'K'
keychain->nextkey = SymReg(VTCONST) "abc"
->nextkey = SymReg(VTCONST) 0
->nextkey = SymReg(VTREG), ...->reg = VTVAR I1
->nextkey = 0
We can't use the consts or keys in the chain directly,
because a different usage would destroy the ->nextkey pointers
so these are all copies.
XXX and currently not freed
SymReg *link_keys
void free_sym
void create_symhash
static void resize_symhash
void _store_symreg
void store_symreg
SymReg *_get_sym
SymReg *get_sym
SymReg *_find_sym
SymReg *find_sym
void clear_sym_hash
void debug_dump_sym_hash
void clear_locals
void clear_globals
unsigned int hash_str
|