locals.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. /*
  7. * L O C A L S . H
  8. */
  9. extern local_p *locals; /* table of locals, index is local-number */
  10. extern short nrlocals; /* number of locals for which we keep ud-info */
  11. void make_localtab(proc_p p);
  12. /* Analyse the text of procedure p to determine
  13. * which local variable p has. Make a table of
  14. * these variables ('locals') and count them
  15. * ('nrlocals'). Also collect register messages.
  16. */
  17. void var_nr(line_p l, short *nr_out, bool *found_out);
  18. /* Compute the 'variable number' of the
  19. * variable referenced by EM instruction l.
  20. */
  21. void find_local(offset off, short *nr_out, bool *found_out);
  22. /* Try to find the local variable at the given
  23. * offset. Return its local-number.
  24. */
  25. /* Every global variable for which ud-info is maintained has
  26. * a 'global variable number' (o_globnr). Every useful local
  27. * has a 'local variable number', which is its index in the
  28. * 'locals' table. All these variables also have a
  29. * 'variable number'. Conversions exist between these numbers.
  30. */
  31. #define TO_GLOBAL(v) (v)
  32. #define TO_LOCAL(v) (v - nrglobals)
  33. #define GLOB_TO_VARNR(v) (v)
  34. #define LOC_TO_VARNR(v) (v + nrglobals)
  35. #define IS_GLOBAL(v) (v <= nrglobals)
  36. #define IS_LOCAL(v) (v > nrglobals)
  37. #define REGVAR(lc) lc->lc_flags |= LCF_REG
  38. #define IS_REGVAR(lc) (lc->lc_flags & LCF_REG)
  39. #define BADLC(lc) lc->lc_flags |= LCF_BAD
  40. #define IS_BADLC(lc) (lc->lc_flags & LCF_BAD)