ic_lookup.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* $Id$ */
  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. /* During Intermediate Code generation data label names ('symbols'),
  11. * procedure names and instruction labels (numbers) are translated
  12. * to resp. a data block pointer, a proc pointer and a label identifier.
  13. * We use three hash tables for this purpose (symhash, prochash, numhash).
  14. * Every name/number is hashed to an index in a specific table. A table
  15. * entry contains a list of structs (sym, prc, num), each one representing
  16. * a 'synonym'. (Synonyms are names/numbers having the same hash value).
  17. */
  18. /* status passed as argument to look_up routines:
  19. * resp. used occurrence, defining occurrence, occurrence in
  20. * a MES ms_ext pseudo.
  21. */
  22. #define OCCURRING 0
  23. #define DEFINING 1
  24. #define IMPORTING 2
  25. #define NSYMHASH 127
  26. #define NPROCHASH 127
  27. #define NNUMHASH 37
  28. extern sym_p symhash[];
  29. extern prc_p prochash[];
  30. extern num_p numhash[];
  31. extern lab_id instr_lab(); /* ( short number)
  32. * Maps EM labels to sequential
  33. * integers.
  34. */
  35. extern dblock_p symlookup(); /* (char *ident, int status)
  36. * Look up the data block with
  37. * the given name.
  38. */
  39. extern dblock_p getsym(); /* ( int status)
  40. * Read and look up a symbol.
  41. * If this is the first occurrence
  42. * of it, then make it external
  43. * (if status=OCCURRING) or
  44. * internal (if DEFINING).
  45. */
  46. extern proc_p getproc(); /* (int status)
  47. * Same as getsym, but for procedure
  48. * names.
  49. */
  50. extern proc_p proclookup(); /* ( char *ident, int status)
  51. * Find (in the hashtable) the
  52. * procedure with the given name.
  53. */
  54. extern cleaninstrlabs(); /* ( )
  55. * Forget about all instruction labels.
  56. */
  57. extern dump_procnames(); /* (prc_p hash[], int n, FILE *f)
  58. * Save the names of the procedures
  59. * in file f; hash is the hashtable
  60. * used and n is its length.
  61. */
  62. extern cleanprocs(); /* (prc_p hash[], int n,mask)
  63. * Make the names of all procedures
  64. * for which p_flags1&mask = 0 invisible
  65. */
  66. extern cleandblocks(); /* (sym_p hash[], int n)
  67. * Make the names of all data blocks
  68. * for which d_flags1&mask = 0 invisible
  69. */