cs_aux.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #include "../share/types.h"
  2. #include "../share/debug.h"
  3. #include "../share/aux.h"
  4. #include "../share/global.h"
  5. #include "../share/lset.h"
  6. #include "cs.h"
  7. #include "cs_entity.h"
  8. offset array_elemsize(vn)
  9. valnum vn;
  10. {
  11. /* Vn is the valuenumber of an entity that points to
  12. * an array-descriptor. The third element of this descriptor holds
  13. * the size of the array-elements.
  14. * IF we can find this entity, AND IF we can find the descriptor AND IF
  15. * this descriptor is located in ROM, then we return the size.
  16. */
  17. entity_p enp;
  18. enp = find_entity(vn);
  19. if (enp == (entity_p) 0)
  20. return UNKNOWN_SIZE;
  21. if (enp->en_kind != ENAEXTERNAL)
  22. return UNKNOWN_SIZE;
  23. if (enp->en_ext->o_dblock->d_pseudo != DROM)
  24. return UNKNOWN_SIZE;
  25. return aoff(enp->en_ext->o_dblock->d_values, 2);
  26. }
  27. occur_p occ_elem(i)
  28. Lindex i;
  29. {
  30. return (occur_p) Lelem(i);
  31. }
  32. entity_p en_elem(i)
  33. Lindex i;
  34. {
  35. return (entity_p) Lelem(i);
  36. }
  37. /* The value numbers associated with each distinct value
  38. * start at 1.
  39. */
  40. STATIC valnum val_no;
  41. valnum newvalnum()
  42. {
  43. /* Return a completely new value number. */
  44. return ++val_no;
  45. }
  46. start_valnum()
  47. {
  48. /* Restart value numbering. */
  49. val_no = 0;
  50. }