Use libFirm's obst.h instead of obstack.h
[libfirm] / ir / ana2 / pto_mod.c
1 /* -*- c -*- */
2
3 /*
4  * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
5  *
6  * This file is part of libFirm.
7  *
8  * This file may be distributed and/or modified under the terms of the
9  * GNU General Public License version 2 as published by the Free Software
10  * Foundation and appearing in the file LICENSE.GPL included in the
11  * packaging of this file.
12  *
13  * Licensees holding valid libFirm Professional Edition licenses may use
14  * this file in accordance with the libFirm Commercial License.
15  * Agreement provided with the Software.
16  *
17  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE.
20  */
21
22 /**
23  * @file
24  * @brief     Load/Store Transfer Functions
25  * @author    Florian
26  * @date      Fri Nov 26 17:29:49 CET 2004
27  * @version   $Id$
28  */
29 #ifdef HAVE_CONFIG_H
30 # include "config.h"
31 #endif
32
33 /*
34   pto_mod: Load/Store Transfer Functions
35 */
36
37 # include "pto_mod.h"
38
39 # include "xmalloc.h"
40
41 # include "pto_debug.h"
42 # include "pto_name.h"
43
44 /* Local Defines: */
45
46 /* Local Data Types: */
47
48 /* Local Variables: */
49
50 /* Local Prototypes: */
51
52 /* ===================================================
53    Local Implementation:
54    =================================================== */
55
56
57 /* ===================================================
58    Exported Implementation:
59    =================================================== */
60 /* Perform the given store; return nonzero iff any involved values change */
61 int mod_store (ir_node *store, ir_entity *ent,
62                 pto_t *ptr_pto, pto_t *val_pto)
63 {
64   int change = 0;
65
66   /* foreach descr in ptr_pto, add val_pto->values to descr.ent */
67
68   qset_t *ptos = ptr_pto->values;
69
70   desc_t *desc = (desc_t*) qset_start (ptos);
71
72   while (NULL != desc) {
73     qset_t *entry = get_entry (desc, ent);
74
75     change |= qset_insert_all (entry, val_pto->values);
76
77     desc = (desc_t*) qset_next (ptos);
78   }
79
80   return (change);
81 }
82
83 /* Perform the given load; return nonzero iff any involved values change */
84 int mod_load  (ir_node *load, ir_entity *ent,
85                 pto_t *ptr_pto)
86 {
87   int change = 0;
88   pto_t *res = get_node_pto (load);
89   /* todo: for each descr in ptr_pto, add descr.ent to res */
90
91   qset_t *ptos = ptr_pto->values;
92   desc_t *desc = (desc_t*) qset_start (ptos);
93
94   while (NULL != desc) {
95     qset_t *entry = get_entry (desc, ent);
96
97     change |= qset_insert_all (res->values, entry);
98
99     desc = (desc_t*) qset_next (ptos);
100   }
101
102   return (change);
103 }
104
105
106 \f
107 /*
108   $Log$
109   Revision 1.3  2006/12/13 19:46:47  beck
110   rename type entity into ir_entity
111
112   Revision 1.2  2004/12/02 16:17:51  beck
113   fixed config.h include
114
115   Revision 1.1  2004/11/30 14:47:54  liekweg
116   fix initialisation; do correct iteration
117
118
119 */