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(NOTNULL(char *name))
void pop_namespace(NULLOK(char *name))
PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL static SymReg *_get_sym_typed(ARGIN(const SymHash *hsh), ARGIN(const char *name), int t)
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *_mk_symreg(NOTNULL(SymHash *hsh), NOTNULL(char *name), int t)
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_symreg(PARROT_INTERP, NOTNULL(char *name), int t)
PARROT_MALLOC PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL char *symreg_to_str(ARGIN(const SymReg *s))
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_temp_reg(PARROT_INTERP, int t)
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL 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), NULLOK(SymReg *arg))
void add_pcc_return(NOTNULL(SymReg *r), NOTNULL(SymReg *arg))
void add_pcc_sub(NOTNULL(SymReg *r), NOTNULL(SymReg *arg))
void add_pcc_cc(NOTNULL(SymReg *r), NOTNULL(SymReg *arg))
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_pasm_reg(PARROT_INTERP, NOTNULL(char *name))
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL char *_mk_fullname(ARGIN_NULLOK(const Namespace *ns), ARGIN(const char *name))
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL char *mk_fullname(ARGIN(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))
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_const_ident(PARROT_INTERP, NOTNULL(char *name), int t, NOTNULL(SymReg *val), int global)
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *_mk_const(NOTNULL(SymHash *hsh), ARGIN(const char *name), int t)
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_const(PARROT_INTERP, ARGIN(const char *name), int t)
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL static char *add_ns(PARROT_INTERP, NOTNULL(char *name))
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *_mk_address(PARROT_INTERP, NOTNULL(SymHash *hsh), NOTNULL(char *name), int uniq)
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_address(PARROT_INTERP, NOTNULL(char *name), int uniq)
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_sub_label(PARROT_INTERP, NOTNULL(char *name))
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_sub_address(PARROT_INTERP, NOTNULL(char *name))
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_local_label(PARROT_INTERP, NOTNULL(char *name))
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_label_address(PARROT_INTERP, NOTNULL(char *name))
PARROT_MALLOC PARROT_CANNOT_RETURN_NULL SymReg *dup_sym(ARGIN(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
PARROT_CANNOT_RETURN_NULL 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(ARGIN(const SymHash *hsh), ARGIN(const char *name))
PARROT_CAN_RETURN_NULL PARROT_WARN_UNUSED_RESULT SymReg *get_sym(PARROT_INTERP, ARGIN(const char *name))
PARROT_CAN_RETURN_NULL PARROT_WARN_UNUSED_RESULT SymReg *_find_sym(PARROT_INTERP, ARGIN_NULLOK(const Namespace *nspace), NOTNULL(SymHash *hsh), ARGIN(const char *name))
PARROT_CAN_RETURN_NULL PARROT_WARN_UNUSED_RESULT SymReg *find_sym(PARROT_INTERP, ARGIN(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(ARGIN(const char *str))
|