Fixed bug with switch conds
[libfirm] / ir / ana2 / pto_mod.c
1 /* -*- c -*- */
2
3 /*
4    Project:     libFIRM
5    File name:   ir/ana/pto_mod.c
6    Purpose:     Load/Store Transfer Functions
7    Author:      Florian
8    Modified by:
9    Created:     Fri Nov 26 17:29:49 CET 2004
10    CVS-ID:      $Id$
11    Copyright:   (c) 1999-2004 Universität Karlsruhe
12    Licence:     This file is protected by the GPL -  GNU GENERAL PUBLIC LICENSE.
13 */
14
15 #ifdef HAVE_CONFIG_H
16 # include "config.h"
17 #endif
18
19 /*
20   pto_mod: Load/Store Transfer Functions
21 */
22
23 # include "pto_mod.h"
24
25 # include "xmalloc.h"
26
27 # include "pto_debug.h"
28 # include "pto_name.h"
29
30 /* Local Defines: */
31
32 /* Local Data Types: */
33
34 /* Local Variables: */
35
36 /* Local Prototypes: */
37
38 /* ===================================================
39    Local Implementation:
40    =================================================== */
41
42
43 /* ===================================================
44    Exported Implementation:
45    =================================================== */
46 /* Perform the given store; return nonzero iff any involved values change */
47 int mod_store (ir_node *store, entity *ent,
48                 pto_t *ptr_pto, pto_t *val_pto)
49 {
50   int change = 0;
51
52   /* foreach descr in ptr_pto, add val_pto->values to descr.ent */
53
54   qset_t *ptos = ptr_pto->values;
55
56   desc_t *desc = (desc_t*) qset_start (ptos);
57
58   while (NULL != desc) {
59     qset_t *entry = get_entry (desc, ent);
60
61     change |= qset_insert_all (entry, val_pto->values);
62
63     desc = (desc_t*) qset_next (ptos);
64   }
65
66   return (change);
67 }
68
69 /* Perform the given load; return nonzero iff any involved values change */
70 int mod_load  (ir_node *load, entity *ent,
71                 pto_t *ptr_pto)
72 {
73   int change = 0;
74   pto_t *res = get_node_pto (load);
75   /* todo: for each descr in ptr_pto, add descr.ent to res */
76
77   qset_t *ptos = ptr_pto->values;
78   desc_t *desc = (desc_t*) qset_start (ptos);
79
80   while (NULL != desc) {
81     qset_t *entry = get_entry (desc, ent);
82
83     change |= qset_insert_all (res->values, entry);
84
85     desc = (desc_t*) qset_next (ptos);
86   }
87
88   return (change);
89 }
90
91
92 \f
93 /*
94   $Log$
95   Revision 1.2  2004/12/02 16:17:51  beck
96   fixed config.h include
97
98   Revision 1.1  2004/11/30 14:47:54  liekweg
99   fix initialisation; do correct iteration
100
101
102 */