ud_aux.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. /* C O P Y P R O P A G A T I O N
  7. *
  8. * A U X I L I A R Y R O U T I N E S
  9. */
  10. #include <em_mnem.h>
  11. #include <em_pseu.h>
  12. #include <em_spec.h>
  13. #include "../share/types.h"
  14. #include "ud.h"
  15. #include "../share/debug.h"
  16. #include "../share/global.h"
  17. #include "../share/alloc.h"
  18. #include "../share/lset.h"
  19. #include "../share/cset.h"
  20. #include "../share/def.h"
  21. #include "../share/locals.h"
  22. #include "../share/aux.h"
  23. #include "ud_defs.h"
  24. void repl_line(line_p old, line_p new, bblock_p b)
  25. {
  26. /* Replace 'old' by 'new' */
  27. if (PREV(old) == (line_p) 0) {
  28. b->b_start = new;
  29. } else {
  30. PREV(old)->l_next = new;
  31. }
  32. PREV(new) = PREV(old);
  33. if ((new->l_next = old->l_next) != (line_p) 0) {
  34. PREV(new->l_next) = new;
  35. }
  36. oldline(old);
  37. }
  38. bool same_var(line_p use, line_p def)
  39. {
  40. /* 'use' is an instruction that uses a variable
  41. * for which we maintain ud-info (e.g. a LOL).
  42. * See if 'def' references the same variable.
  43. */
  44. if (TYPE(use) == OPOBJECT) {
  45. return TYPE(def) == OPOBJECT && OBJ(use) == OBJ(def);
  46. } else {
  47. return TYPE(def) != OPOBJECT && off_set(use) == off_set(def);
  48. }
  49. }