PIPS
phrase_tools.h
Go to the documentation of this file.
1 /*
2 
3  $Id: phrase_tools.h 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 #ifndef PHRASE_TOOLS_DEFS
25 #define PHRASE_TOOLS_DEFS
26 
27 /**
28  * DEBUG FUNCTION: return a string representing the type of the
29  * statement (SEQUENCE, CALL, etc...)
30  */
32 
33 /**
34  * DEBUG FUNCTION: print debugging informations for
35  * a statement stat
36  */
37 void debug_statement (const char* comments, statement stat, int debug_level);
38 
39 /**
40  * DEBUG FUNCTION: print debugging informations for
41  * a control a_control
42  */
43 void debug_control (const char* comments, control a_control, int debug_level);
44 
45 /**
46  * DEBUG FUNCTION: print debugging informations for
47  * an unstructured an_unstructured
48  */
49 void debug_unstructured (unstructured an_unstructured,
50  int debug_level);
51 /**
52  * DEBUG FUNCTION: print debugging informations for
53  * an unstructured an_unstructured (short version)
54  */
55 void short_debug_unstructured (unstructured an_unstructured,
56  int debug_level);
57 
58 /**
59  * This function build and return an expression given
60  * an entity an_entity
61  */
63 
64 
65 /**
66  * Build and return new statement which is a binary call with
67  * the 2 expressions expression1 and expression2, with empty
68  * label, statement number and ordering of statement stat,
69  * and empty comments
70  */
71 statement make_binary_call_statement (const char* operator_name,
72  expression expression1,
73  expression expression2,
74  statement stat);
75 
76 /**
77  * This function build and return new variable from
78  * a variable a_variable, with name new_name. If an entity
79  * called new_name already exists, return NULL.
80  * New variable is added to declarations
81  */
83  const char* new_name,
84  const char* module_name);
85 
86 /**
87  * Build and return new entity obtained by cloning variable
88  * cloned_variable, with a name obtained by the concatenation
89  * of base_name and the statement ordering of statement stat.
90  * If such entity already exist, increment statement ordering
91  * to get first free name. We assume then that created entity's
92  * name is unique.
93  */
95  const char* base_name,
96  statement stat,
97  const char* module_name);
98 
99 /**
100  * Build and return new statement which is a assignement of variable
101  * a_variable with expression an_expression, with empty label, statement
102  * number and ordering of statement stat, and empty comments
103  */
105  expression an_expression,
106  statement stat);
107 
109 
110 /**
111  * Special function made for Ronan Keryell who likes a lot
112  * when a integer number is coded on 3 bits :-)
113  */
114 int beautify_ordering (int an_ordering);
115 
116 void clean_statement_from_tags (const char* comment_portion,
117  statement stat);
118 
119 list get_statements_with_comments_containing (const char* comment_portion,
120  statement stat);
121 
123  statement searched_stat);
124 
126  statement searched_stat);
127 
129  statement new_stat,
130  statement root_stat);
131 
132 list references_for_regions (list l_regions);
133 
134 
135 #endif
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
static entity a_variable
unstructured statement_unstructured(statement stat)
Get the unstructured of a statement.
Definition: statement.c:1416
entity make_variable_from_name_and_entity(entity cloned_variable, const char *base_name, statement stat, const char *module_name)
Build and return new entity obtained by cloning variable cloned_variable, with a name obtained by the...
Definition: phrase_tools.c:325
list get_statements_with_comments_containing(const char *comment_portion, statement stat)
Definition: phrase_tools.c:481
void debug_unstructured(unstructured an_unstructured, int debug_level)
DEBUG FUNCTION: print debugging informations for an unstructured an_unstructured.
Definition: phrase_tools.c:146
list references_for_regions(list l_regions)
Return a list of references corresponding to a list of regions.
Definition: phrase_tools.c:603
string statement_type_as_string(statement stat)
DEBUG FUNCTION: return a string representing the type of the statement (SEQUENCE, CALL,...
Definition: phrase_tools.c:65
entity clone_variable_with_new_name(entity a_variable, const char *new_name, const char *module_name)
This function build and return new variable from a variable a_variable, with name new_name.
Definition: phrase_tools.c:269
void debug_control(const char *comments, control a_control, int debug_level)
DEBUG FUNCTION: print debugging informations for a control a_control.
Definition: phrase_tools.c:134
statement make_assignement_statement(entity a_variable, expression an_expression, statement stat)
Build and return new statement which is a assignement of variable a_variable with expression an_expre...
Definition: phrase_tools.c:392
void debug_statement(const char *comments, statement stat, int debug_level)
DEBUG FUNCTION: print debugging informations for a statement stat.
Definition: phrase_tools.c:111
expression make_expression_from_entity(entity an_entity)
This function build and return an expression given an entity an_entity.
void clean_statement_from_tags(const char *comment_portion, statement stat)
Definition: phrase_tools.c:414
int beautify_ordering(int an_ordering)
Special function made for Ronan Keryell who likes a lot when a integer number is coded on 3 bits :-)
Definition: phrase_tools.c:407
void short_debug_unstructured(unstructured an_unstructured, int debug_level)
DEBUG FUNCTION: print debugging informations for an unstructured an_unstructured (short version)
Definition: phrase_tools.c:213
statement make_binary_call_statement(const char *operator_name, expression expression1, expression expression2, statement stat)
Build and return new statement which is a binary call with the 2 expressions expression1 and expressi...
Definition: phrase_tools.c:354
bool statement_is_contained_in_a_sequence_p(statement root_statement, statement searched_stat)
Definition: phrase_tools.c:507
statement sequence_statement_containing(statement root_statement, statement searched_stat)
Definition: phrase_tools.c:536
void replace_in_sequence_statement_with(statement old_stat, statement new_stat, statement root_stat)
Replace statement old_stat by statement new_stat, asserting that this statement is contained in a seq...
Definition: phrase_tools.c:554
The structure used to build lists in NewGen.
Definition: newgen_list.h:41