PIPS
fsm_split_state.c
Go to the documentation of this file.
1 /*
2 
3  $Id: fsm_split_state.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 <stdio.h>
28 #include <ctype.h>
29 
30 #include "genC.h"
31 #include "linear.h"
32 #include "ri.h"
33 #include "effects.h"
34 
35 #include "resources.h"
36 
37 #include "misc.h"
38 #include "ri-util.h"
39 #include "effects-util.h"
40 #include "pipsdbm.h"
41 
42 #include "text-util.h"
43 
44 
45 #include "control.h"
46 #include "callgraph.h"
47 
48 #include "fsm_generation.h"
49 
50 /*********************************************************
51  * Phase main
52  *********************************************************/
53 
54 bool fsm_split_state(const char* module_name)
55 {
56  /* get the resources */
57  statement stat = (statement) db_get_memory_resource(DBR_CODE,
58  module_name,
59  true);
60 
63 
64  debug_on("FSM_SPLIT_STATE_DEBUG_LEVEL");
65  /* Now do the job */
66 
67  pips_assert("Statement is consistent after FSM_SPLIT_STATE",
69 
70  /* Reorder the module, because new statements have been added */
71  module_reorder(stat);
72  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, stat);
73  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
74  compute_callees(stat));
75 
76  /* update/release resources */
79 
80  debug_off();
81 
82  return true;
83 }
bool statement_consistent_p(statement p)
Definition: ri.c:2195
callees compute_callees(const statement stat)
Recompute the callees of a module statement.
Definition: callgraph.c:355
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
bool fsm_split_state(const char *module_name)
fsm_split_state.c
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
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 pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define debug_off()
Definition: misc-local.h:160
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479