PIPS
formal_array_resizing_bottom_up.c
Go to the documentation of this file.
1 // DEAD CODE
2 
3 /*
4 
5  $Id: formal_array_resizing_bottom_up.c 23065 2016-03-02 09:05:50Z coelho $
6 
7  Copyright 1989-2016 MINES ParisTech
8 
9  This file is part of PIPS.
10 
11  PIPS is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  any later version.
15 
16  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
17  WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE.
19 
20  See the GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
24 
25 */
26 #ifdef HAVE_CONFIG_H
27  #include "pips_config.h"
28 #endif
29 /******************************************************************
30  *
31  * BOTTOM UP ARRAY RESIZING
32  *
33  *
34 *******************************************************************/
35 
36 #include <stdio.h>
37 #include <stdlib.h>
38 #include <string.h>
39 #include "genC.h"
40 #include "linear.h"
41 #include "ri.h"
42 #include "effects.h"
43 #include "ri-util.h"
44 #include "effects-util.h"
45 #include "database.h"
46 #include "pipsdbm.h"
47 #include "resources.h"
48 #include "misc.h"
49 #include "control.h"
50 #include "properties.h"
51 #include "semantics.h"
52 #include "transformer.h"
53 #include "pipsmake.h"
54 #include "abc_private.h"
55 #include "effects-generic.h"
56 #include "effects-convex.h"
57 #include "effects-simple.h"
58 #include "conversion.h"
59 #include "text-util.h" /* for words_to_string*/
60 #include "transformations.h"
61 
63 static string current_mod ="";
64 
65 #define PREFIX_DEC "$DEC"
66 
67 
68 /* This phase do array resizing for unnormalized and formal arguments only.
69  So we only need SUMMARY_REGIONS */
70 bool formal_array_resizing_bottom_up(char* mod_name)
71 {
73  list l_decl = code_declarations(entity_code(mod_ent)), l_regions = NIL;
74  statement mod_stmt = (statement) db_get_memory_resource(DBR_CODE, mod_name, true);
75  transformer mod_pre;
76  Psysteme pre;
77  current_mod = mod_name;
79  db_get_memory_resource(DBR_PRECONDITIONS,mod_name,true));
81  db_get_memory_resource(DBR_SUMMARY_REGIONS, mod_name, true));
82  regions_init();
83  debug_on("FORMAL_ARRAY_RESIZING_BOTTOM_UP_DEBUG_LEVEL");
84  debug(1," Begin bottom up formal array resizing for %s\n", mod_name);
85  l_regions = load_rw_effects_list(mod_stmt);
86  mod_pre = load_statement_precondition(mod_stmt);
87  pre = predicate_system(transformer_relation(mod_pre));
88  user_log("\n-------------------------------------------------------------------------------------\n");
89  user_log("Prefix \tFile \tModule \tArray \tNdim \tNew declaration\tOld declaration\n");
90  user_log("---------------------------------------------------------------------------------------\n");
91 
92  while (!ENDP(l_decl))
93  {
94  entity e = ENTITY(CAR(l_decl));
95  if (unnormalized_array_p(e))
96  {
97  storage s = entity_storage(e);
98  if (storage_formal_p(s))
99  {
100  region reg = find_union_regions(l_regions,e);
101  new_array_declaration_from_region(reg,e,pre);
102  }
103  }
104  l_decl = CDR(l_decl);
105  }
106  user_log(" \n The total number of right array declarations : %d \n"
108 
109  debug(1,"End bottom up formal array resizing for %s\n", mod_name);
110  debug_off();
111  regions_end();
114  current_mod = "";
115  DB_PUT_MEMORY_RESOURCE(DBR_CODE, mod_name, mod_stmt);
116  return true;
117 }
118 
void user_log(const char *format,...)
Definition: message.c:234
static entity mod_ent
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
#define region
simulation of the type region
void regions_end(void)
void regions_init(void)
void set_rw_effects(statement_effects)
list load_rw_effects_list(statement)
void reset_rw_effects(void)
static int number_of_right_array_declarations
for words_to_string
bool formal_array_resizing_bottom_up(char *mod_name)
This phase do array resizing for unnormalized and formal arguments only.
static string current_mod
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
code entity_code(entity e)
Definition: entity.c:1098
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
bool unnormalized_array_p(entity e)
Definition: entity.c:846
#define storage_formal_p(x)
Definition: ri.h:2522
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define entity_storage(x)
Definition: ri.h:2794
#define code_declarations(x)
Definition: ri.h:784
#define transformer_relation(x)
Definition: ri.h:2873
#define predicate_system(x)
Definition: ri.h:2069
transformer load_statement_precondition(statement)
void reset_precondition_map(void)
void set_precondition_map(statement_mapping)
The structure used to build lists in NewGen.
Definition: newgen_list.h:41