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(char *name)
void pop_namespace(NULLOK(char *name))
static SymReg *_get_sym_typed(NOTNULL(const SymHash *hsh), NOTNULL(const char *name), int t)
SymReg *_mk_symreg(NOTNULL(SymHash *hsh), NOTNULL(char *name), int t)
SymReg *mk_symreg(PARROT_INTERP, NOTNULL(char *name), int t)
PARROT_MALLOC char *symreg_to_str(NOTNULL(const SymReg *s))
SymReg *mk_temp_reg(PARROT_INTERP, int t)
SymReg *mk_pcc_sub(PARROT_INTERP, NOTNULL(char *name), int proto)
void add_namespace(PARROT_INTERP, NOTNULL(struct _IMC_Unit *unit))
void add_pcc_arg(NOTNULL(SymReg *r), NOTNULL(SymReg *arg))
void add_pcc_param(NOTNULL(SymReg *r), NOTNULL(SymReg *arg))
void add_pcc_result(NOTNULL(SymReg *r), NOTNULL(SymReg *arg))
void add_pcc_multi(NOTNULL(SymReg *r), SymReg *arg)
void add_pcc_return(NOTNULL(SymReg *r), NOTNULL(SymReg *arg))
void add_pcc_sub(NOTNULL(SymReg *r), SymReg *arg)
void add_pcc_cc(NOTNULL(SymReg *r), SymReg *arg)
SymReg *mk_pasm_reg(PARROT_INTERP, char *name)
char *_mk_fullname(NULLOK(const Namespace *ns), NOTNULL(const char *name))
char *mk_fullname(NOTNULL(const char *name))
PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT SymReg *mk_ident(PARROT_INTERP, NOTNULL(char *name), int t)
PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT SymReg *mk_ident_ur(PARROT_INTERP, NOTNULL(char *name), int t)
PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT static SymReg *mk_pmc_const_2(PARROT_INTERP, NOTNULL(IMC_Unit *unit), NOTNULL(SymReg *left), NOTNULL(SymReg *rhs))
SymReg *mk_const_ident(PARROT_INTERP, NOTNULL(char *name), int t, NOTNULL(SymReg *val), int global)
SymReg *_mk_const(NOTNULL(SymHash *hsh), NOTNULL(const char *name), int t)
SymReg *mk_const(PARROT_INTERP, NOTNULL(const char *name), int t)
static char *add_ns(PARROT_INTERP, NOTNULL(char *name))
SymReg *_mk_address(PARROT_INTERP, NOTNULL(SymHash *hsh), NOTNULL(char *name), int uniq)
SymReg *mk_address(PARROT_INTERP, char *name, int uniq)
SymReg *mk_sub_label(PARROT_INTERP, NOTNULL(char *name))
SymReg *mk_sub_address(PARROT_INTERP, NOTNULL(char *name))
SymReg *mk_local_label(PARROT_INTERP, NOTNULL(char *name))
SymReg *mk_label_address(PARROT_INTERP, NOTNULL(char *name))
PARROT_MALLOC SymReg *dup_sym(NOTNULL(const SymReg *r))
"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(PARROT_INTERP, int nargs, NOTNULL(SymReg *keys[]), int force)
void free_sym(NOTNULL(SymReg *r))
void create_symhash(NOTNULL(SymHash *hash))
static void resize_symhash(NOTNULL(SymHash *hsh))
void _store_symreg(NOTNULL(SymHash *hsh), NOTNULL(SymReg *r))
void store_symreg(PARROT_INTERP, NOTNULL(SymReg *r))
PARROT_CAN_RETURN_NULL PARROT_WARN_UNUSED_RESULT SymReg *_get_sym(NOTNULL(SymHash *hsh), NOTNULL(const char *name))
PARROT_CAN_RETURN_NULL PARROT_WARN_UNUSED_RESULT SymReg *get_sym(PARROT_INTERP, NOTNULL(const char *name))
PARROT_CAN_RETURN_NULL PARROT_WARN_UNUSED_RESULT SymReg *_find_sym(PARROT_INTERP, NULLOK(const Namespace *nspace), NOTNULL(SymHash *hsh), NOTNULL(const char *name))
PARROT_CAN_RETURN_NULL PARROT_WARN_UNUSED_RESULT SymReg *find_sym(PARROT_INTERP, NOTNULL(const char *name))
void clear_sym_hash(NOTNULL(SymHash *hsh))
void debug_dump_sym_hash(NOTNULL(SymHash *hsh))
void clear_locals(NULLOK(struct _IMC_Unit *unit))
void clear_globals(PARROT_INTERP)
PARROT_PURE_FUNCTION unsigned int hash_str(NOTNULL(const char *str))
|