PIPS
dbase.c
Go to the documentation of this file.
1 /*
2 
3  $Id: dbase.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 #include "all.h"
28 
29 /* ---------------------------------------------------------------------- */
30 /* list-comp_desc conversion functions */
31 /* ---------------------------------------------------------------------- */
32 
34 list l_eff;
35 {
36  comp_desc_set res = make_comp_desc_set(l_eff);
37  return res;
38 }
39 
41 comp_desc_set cset;
42 {
43  list l_res = comp_desc_set_comp_descs(cset);
44  return l_res;
45 }
46 
48 statement_mapping l_map;
49 {
50  statement_mapping comp_secs_map = MAKE_STATEMENT_MAPPING();
51 
53  {
54  hash_put((hash_table) comp_secs_map, (char *) s, (char *) list_to_comp_secs((list) val));
55  }, l_map);
56 
57  return comp_secs_map;
58 }
59 
61 statement_mapping compsecs_map;
62 {
64 
65  STATEMENT_MAPPING_MAP(s,val,{
66  hash_put((hash_table) l_map, (char *) s, (char *) comp_desc_set_to_list((comp_desc_set) val));
67  }, compsecs_map);
68 
69  return l_map;
70 }
71 
72 /*********************************************************************************/
73 /* REGIONS AND LISTS OF REGIONS MANIPULATION */
74 /*********************************************************************************/
75 
76 /* list comp_regions_dup(list l_reg)
77  * input : a list of comp_regions.
78  * output : a new list of regions, in which each region of the
79  * initial list is duplicated.
80  * modifies : nothing.
81  */
83 {
84  list l_reg_dup = NIL;
85 
86  MAP(COMP_DESC, reg,
87  {
88  comp_desc reg_dup = comp_region_dup(reg);
89  l_reg_dup = comp_region_add_to_regions(reg_dup, l_reg_dup);
90  }, l_reg);
91 
92  return(l_reg_dup);
93 }
94 
96 {
97  comp_desc new_reg;
98 
99  /* debug_region_consistency(reg); */
100  new_reg = copy_comp_desc(reg);
101  /* work around persistency of comp_desc reference */
103  return(new_reg);
104 }
105 /* void region_add_to_regions(region reg, list l_reg)
106  * input : a region and a list of regions.
107  * output : nothing.
108  * modifies : l_reg.
109  * comment : adds reg at the end of l_reg.
110  */
112 {
113  return gen_nconc(l_reg, CONS(COMP_DESC, reg, NIL));
114 }
115 
116 
117 
118 
119 
comp_desc_set make_comp_desc_set(list a)
Definition: compsec.c:138
comp_desc copy_comp_desc(comp_desc p)
COMP_DESC.
Definition: compsec.c:60
reference copy_reference(reference p)
REFERENCE.
Definition: ri.c:2047
#define comp_desc_reference(x)
Definition: compsec.h:177
#define COMP_DESC(x)
COMP_DESC.
Definition: compsec.h:146
#define comp_desc_set_comp_descs(x)
Definition: compsec.h:213
list comp_region_add_to_regions(comp_desc reg, list l_reg)
void region_add_to_regions(region reg, list l_reg) input : a region and a list of regions.
Definition: dbase.c:111
comp_desc comp_region_dup(comp_desc reg)
Definition: dbase.c:95
list comp_regions_dup(list l_reg)
REGIONS AND LISTS OF REGIONS MANIPULATION
Definition: dbase.c:82
list comp_desc_set_to_list(comp_desc_set cset)
Definition: dbase.c:40
statement_mapping listmap_to_compsecs_map(statement_mapping l_map)
Definition: dbase.c:47
statement_mapping comp_secs_map_to_listmap(statement_mapping compsecs_map)
Definition: dbase.c:60
comp_desc_set list_to_comp_secs(list l_eff)
list-comp_desc conversion functions
Definition: dbase.c:33
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
#define MAKE_STATEMENT_MAPPING()
Definition: newgen-local.h:43
#define STATEMENT_MAPPING_MAP(s, v, code, h)
Definition: newgen-local.h:53
The structure used to build lists in NewGen.
Definition: newgen_list.h:41