NAME ^

compilers/imcc/symreg.c

DESCRIPTION ^

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)

Functions ^

void push_namespace(NOTNULL(char *name))

RT#48260: Not yet documented!!!

void pop_namespace(NULLOK(char *name))

RT#48260: Not yet documented!!!

PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL static SymReg *_get_sym_typed(ARGIN(const SymHash *hsh), ARGIN(const char *name), int t)

Gets a symbol from the hash

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *_mk_symreg(NOTNULL(SymHash *hsh), NOTNULL(char *name), int t)

Makes a new SymReg from its varname and type

char * name is a malloced string that will be used if the symbol needs to be created, or freed if an old symbol is found. This is a potentially dangerous semantic that should be changed.

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_symreg(PARROT_INTERP, NOTNULL(char *name), int t)

RT#48260: Not yet documented!!!

PARROT_MALLOC PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL char *symreg_to_str(ARGIN(const SymReg *s))

Dump a SymReg to a printable format.

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_temp_reg(PARROT_INTERP, int t)

RT#48260: Not yet documented!!!

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_pcc_sub(PARROT_INTERP, NOTNULL(char *name), int proto)

RT#48260: Not yet documented!!!

void add_namespace(PARROT_INTERP, NOTNULL(struct _IMC_Unit *unit))

add current namespace to sub decl

void add_pcc_arg(NOTNULL(SymReg *r), NOTNULL(SymReg *arg))

Add a register or constant to the function arg list

void add_pcc_param(NOTNULL(SymReg *r), NOTNULL(SymReg *arg))

RT#48260: Not yet documented!!!

void add_pcc_result(NOTNULL(SymReg *r), NOTNULL(SymReg *arg))

RT#48260: Not yet documented!!!

void add_pcc_multi(NOTNULL(SymReg *r), NULLOK(SymReg *arg))

RT#48260: Not yet documented!!!

void add_pcc_return(NOTNULL(SymReg *r), NOTNULL(SymReg *arg))

RT#48260: Not yet documented!!!

void add_pcc_sub(NOTNULL(SymReg *r), NOTNULL(SymReg *arg))

RT#48260: Not yet documented!!!

void add_pcc_cc(NOTNULL(SymReg *r), NOTNULL(SymReg *arg))

RT#48260: Not yet documented!!!

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_pasm_reg(PARROT_INTERP, NOTNULL(char *name))

RT#48260: Not yet documented!!!

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL char *_mk_fullname(ARGIN_NULLOK(const Namespace *ns), ARGIN(const char *name))

RT#48260: Not yet documented!!!

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL char *mk_fullname(ARGIN(const char *name))

RT#48260: Not yet documented!!!

PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT SymReg *mk_ident(PARROT_INTERP, NOTNULL(char *name), int t)

Makes a new identifier

PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT SymReg *mk_ident_ur(PARROT_INTERP, NOTNULL(char *name), int t)

RT#48260: Not yet documented!!!

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))

RT#48260: Not yet documented!!!

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_const_ident(PARROT_INTERP, NOTNULL(char *name), int t, NOTNULL(SymReg *val), int global)

Makes a new identifier constant with value val

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *_mk_const(NOTNULL(SymHash *hsh), ARGIN(const char *name), int t)

Makes a new constant

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_const(PARROT_INTERP, ARGIN(const char *name), int t)

RT#48260: Not yet documented!!!

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL static char *add_ns(PARROT_INTERP, NOTNULL(char *name))

add namespace to sub if any

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *_mk_address(PARROT_INTERP, NOTNULL(SymHash *hsh), NOTNULL(char *name), int uniq)

Makes a new address

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_address(PARROT_INTERP, NOTNULL(char *name), int uniq)

Eventually make mk_address static

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_sub_label(PARROT_INTERP, NOTNULL(char *name))

Make and store a new address label for a sub. Label gets a fixup entry.

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_sub_address(PARROT_INTERP, NOTNULL(char *name))

Make a symbol for a label, symbol gets a fixup entry.

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_local_label(PARROT_INTERP, NOTNULL(char *name))

Make a local symbol, no fixup entry.

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL SymReg *mk_label_address(PARROT_INTERP, NOTNULL(char *name))

RT#48260: Not yet documented!!!

PARROT_MALLOC PARROT_CANNOT_RETURN_NULL SymReg *dup_sym(ARGIN(const SymReg *r))

link keys to a keys structure = SymReg

we might have

what op type pbc.c:build_key() -------------------------------------------------- int const _kic VTCONST no int reg _ki VTREG no str const _kc VTCONST yes str reg _kc VTREG yes

 "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)

RT#48260: Not yet documented!!!

void free_sym(NOTNULL(SymReg *r))

RT#48260: Not yet documented!!!

void create_symhash(NOTNULL(SymHash *hash))

RT#48260: Not yet documented!!!

static void resize_symhash(NOTNULL(SymHash *hsh))

RT#48260: Not yet documented!!!

void _store_symreg(NOTNULL(SymHash *hsh), NOTNULL(SymReg *r))

Stores a symbol into the hash

void store_symreg(PARROT_INTERP, NOTNULL(SymReg *r))

RT#48260: Not yet documented!!!

PARROT_CAN_RETURN_NULL PARROT_WARN_UNUSED_RESULT SymReg *_get_sym(ARGIN(const SymHash *hsh), ARGIN(const char *name))

Gets a symbol from the hash

PARROT_CAN_RETURN_NULL PARROT_WARN_UNUSED_RESULT SymReg *get_sym(PARROT_INTERP, ARGIN(const char *name))

Gets a symbol from the current unit symbol table

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))

find a symbol hash or ghash

PARROT_CAN_RETURN_NULL PARROT_WARN_UNUSED_RESULT SymReg *find_sym(PARROT_INTERP, ARGIN(const char *name))

RT#48260: Not yet documented!!!

void clear_sym_hash(NOTNULL(SymHash *hsh))

RT#48260: Not yet documented!!!

void debug_dump_sym_hash(NOTNULL(SymHash *hsh))

RT#48260: Not yet documented!!!

void clear_locals(NULLOK(struct _IMC_Unit *unit))

Deletes all local symbols and clears life info

void clear_globals(PARROT_INTERP)

Clear global symbols

PARROT_PURE_FUNCTION unsigned int hash_str(ARGIN(const char *str))

RT#48260: Not yet documented!!!


parrot