home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 2 / MacMania 2.toast / Demo's / Tools&Utilities / Programming / SPIM Folder / Sources / sym_tbl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-05  |  2.5 KB  |  71 lines  |  [TEXT/ttxt]

  1. /* SPIM S20 MIPS simulator.
  2.    Data structures for symbolic addresses.
  3.    Copyright (C) 1990 by James Larus (larus@cs.wisc.edu).
  4.  
  5.    SPIM is free software; you can redistribute it and/or modify it
  6.    under the terms of the GNU General Public License as published by the
  7.    Free Software Foundation; either version 1, or (at your option) any
  8.    later version.
  9.  
  10.    SPIM is distributed in the hope that it will be useful, but WITHOUT
  11.    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12.    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13.    for more details.
  14.  
  15.    You should have received a copy of the GNU General Public License
  16.    along with GNU CC; see the file COPYING.  If not, write to James R.
  17.    Larus, Computer Sciences Department, University of Wisconsin--Madison,
  18.    1210 West Dayton Street, Madison, WI 53706, USA or to the Free
  19.    Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
  20.  
  21.  
  22. /* $Header: /var/home/cs354/.spim/RCS/sym_tbl.h,v 1.2 1992/10/07 04:09:21 cs354 Exp $
  23. */
  24.  
  25.  
  26. typedef struct lab_use
  27. {
  28.   instruction *inst;        /* NULL => Data, not code */
  29.   mem_addr addr;
  30.   struct lab_use *next;
  31. } label_use;
  32.  
  33.  
  34. /* Symbol table information on a label. */
  35.  
  36. typedef struct lab
  37. {
  38.   char *name;            /* Name of label */
  39.   int addr;            /* Address of label or 0 if not yet defined */
  40.   unsigned char global_flag;    /* Non-zero => declared global */
  41.   unsigned char gp_flag;    /* Non-zero => referenced off gp */
  42.   unsigned char type;        /* set below */
  43.   struct lab *next;        /* Hash table link */
  44.   struct lab *next_local;    /* Link in list of local labels */
  45.   label_use *uses;        /* List of instructions that reference */
  46. } label;            /* label that has not yet been defined */
  47.  
  48.  
  49. #define SYMBOL_IS_DEFINED(SYM) ((SYM)->addr != 0)
  50.  
  51. #define UNKNOWN_A_TYPE    0
  52. #define WORD_A_TYPE    1
  53. #define FLOAT_A_TYPE    2
  54. #define DOUBLE_A_TYPE    3
  55. #define BYTE_A_TYPE    4
  56.  
  57. extern    void initialize_symbol_table(void );
  58. extern    label *lookup_label(char *name);
  59. extern    label *record_label(char *name,unsigned long address);
  60. extern    label *set_label_type(label *l,unsigned char type);
  61. extern    int get_label_type(char *name);
  62. extern    label *make_label_global(char *name);
  63. extern    void record_inst_uses_symbol(instruction *inst,unsigned long pc,
  64.     label *sym);
  65. extern    void record_data_uses_symbol(unsigned long location,label *sym);
  66. extern    void resolve_a_label(const label *sym,instruction *inst,
  67.     unsigned long pc);
  68. extern    void flush_local_labels(void );
  69. extern    unsigned long find_symbol_address(char *symbol);
  70. extern    void print_symbols(void );
  71.