Pristine Ack-5.5
[Ack-5.5.git] / util / ego / ic / ic_lookup.h
1 /* $Id: ic_lookup.h,v 1.4 1994/06/24 10:24:26 ceriel Exp $ */
2 /*
3  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4  * See the copyright notice in the ACK home directory, in the file "Copyright".
5  */
6 /*  I N T E R M E D I A T E   C O D E
7  *
8  *  L O O K - U P   R O U T I N E S
9  */
10
11 /* During Intermediate Code generation data label names ('symbols'),
12  * procedure names and instruction labels (numbers) are translated
13  * to resp. a data block pointer, a proc pointer and a label identifier.
14  * We use three hash tables for this purpose (symhash, prochash, numhash).
15  * Every name/number is hashed to an index in a specific table. A table
16  * entry contains a list of structs (sym, prc, num), each one representing
17  * a 'synonym'. (Synonyms are names/numbers having the same hash value).
18  */
19
20
21 /* status passed as argument to look_up routines:
22  * resp. used occurrence, defining occurrence, occurrence in
23  * a MES ms_ext pseudo.
24  */
25
26 #define OCCURRING       0
27 #define DEFINING        1
28 #define IMPORTING       2
29
30 #define NSYMHASH 127
31 #define NPROCHASH 127
32 #define NNUMHASH  37
33
34 extern sym_p symhash[];
35 extern prc_p prochash[];
36 extern num_p numhash[];
37
38 extern lab_id   instr_lab();            /* ( short number)
39                                          * Maps EM labels to sequential
40                                          * integers.
41                                          */
42 extern dblock_p symlookup();            /* (char *ident, int status)
43                                          * Look up the data block with
44                                          * the given name.
45                                          */
46 extern dblock_p getsym();               /* ( int status)
47                                          * Read and look up a symbol.
48                                          * If this is the first occurrence
49                                          * of it, then make it external
50                                          * (if status=OCCURRING) or
51                                          * internal (if DEFINING).
52                                          */
53 extern proc_p   getproc();              /* (int status)
54                                          * Same as getsym, but for procedure
55                                          * names.
56                                          */
57 extern proc_p   proclookup();           /* ( char *ident, int status)
58                                          * Find (in the hashtable) the
59                                          * procedure with the given name.
60                                          */
61 extern          cleaninstrlabs();       /* ( )
62                                          * Forget about all instruction labels.
63                                          */
64 extern          dump_procnames();       /* (prc_p hash[], int n, FILE *f)
65                                          * Save the names of the procedures
66                                          * in file f; hash is the hashtable
67                                          * used and n is its length.
68                                          */
69 extern          cleanprocs();           /* (prc_p hash[], int n,mask)
70                                          * Make the names of all procedures
71                                          * for which p_flags1&mask = 0 invisible
72                                          */
73 extern          cleandblocks();         /* (sym_p hash[], int n)
74                                          * Make the names of all data blocks
75                                          * for which d_flags1&mask = 0 invisible
76                                          */