Pristine Ack-5.5
[Ack-5.5.git] / util / ego / ud / ud_aux.c
1 /* $Id: ud_aux.c,v 1.5 1994/06/24 10:33:14 ceriel Exp $ */
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
11
12 #include <em_mnem.h>
13 #include <em_pseu.h>
14 #include <em_spec.h>
15 #include "../share/types.h"
16 #include "ud.h"
17 #include "../share/debug.h"
18 #include "../share/global.h"
19 #include "../share/alloc.h"
20 #include "../share/lset.h"
21 #include "../share/cset.h"
22 #include "../share/def.h"
23 #include "../share/locals.h"
24 #include "../share/aux.h"
25 #include "ud_defs.h"
26
27 repl_line(old,new,b)
28         line_p old,new;
29         bblock_p b;
30 {
31         /* Replace 'old' by 'new' */
32
33         if (PREV(old) == (line_p) 0) {
34                 b->b_start = new;
35         } else {
36                 PREV(old)->l_next = new;
37         }
38         PREV(new) = PREV(old);
39         if ((new->l_next = old->l_next) != (line_p) 0) {
40                 PREV(new->l_next) = new;
41         }
42         oldline(old);
43 }
44
45
46
47 bool same_var(use,def)
48         line_p use,def;
49 {
50         /* 'use' is an instruction that uses a variable
51          * for which we maintain ud-info (e.g. a LOL).
52          * See if 'def' references the same variable.
53          */
54
55         if (TYPE(use) == OPOBJECT) {
56                 return TYPE(def) == OPOBJECT && OBJ(use) == OBJ(def);
57         } else {
58                 return TYPE(def) != OPOBJECT && off_set(use) == off_set(def);
59         }
60 }