25 #include "pips_config.h"
47 #include "resources.h"
68 string intrinsic_name)
89 string state_variable_name;
97 if (name_identifier == 0) {
116 return new_state_variable;
131 int assignement_value)
135 call assignment_call;
155 return returned_statement;
166 pips_assert(
"Statement is UNSTRUCTURED in FSM_GENERATION",
182 pips_assert(
"Statement is UNSTRUCTURED in FSM_GENERATION",
226 int current_transition_number;
230 debug_control (
"TRANSITION: Module statement", current_node, 2);
236 current_transition_number,
241 if ((successors_nb == 0) || (successors_nb == 1)) {
246 if (successors_nb == 0) {
259 state_variable_assignement
261 (stat, state_variable, next_value);
271 transition_instruction
273 transition_sequence);
279 transition_instruction,
NIL,NULL,
282 else if (successors_nb == 2) {
294 sequence transition_sequence_if_true;
295 sequence transition_sequence_if_false;
298 statement state_variable_assignement_if_true;
299 statement state_variable_assignement_if_false;
304 pips_assert(
"Statement with 2 successors is a TEST in FSM_GENERATION",
312 old_statement_if_true =
test_true(current_test);
314 state_variable_assignement_if_true
316 (stat, state_variable, value_if_true);
318 transition_sequence_if_true
320 old_statement_if_true,
323 transition_instruction_if_true
325 transition_sequence_if_true);
331 transition_instruction_if_true,
335 test_true(current_test) = transition_statement_if_true;
339 old_statement_if_false =
test_false(current_test);
341 state_variable_assignement_if_false
343 (stat, state_variable, value_if_false);
345 transition_sequence_if_false
347 old_statement_if_false,
350 transition_instruction_if_false
352 transition_sequence_if_false);
354 transition_statement_if_false
360 transition_instruction_if_false,
NIL,NULL,
363 test_false(current_test) = transition_statement_if_false;
365 transition_statement = stat;
369 pips_assert(
"I should NOT be there :-)", 2+2 != 4);
388 test_instruction,
NIL,NULL,
391 return returned_statement;
409 pips_assert(
"Statement is UNSTRUCTURED in FSM_GENERATION",
423 if (returned_statement == NULL) {
424 returned_statement = transition_statement;
430 pips_assert(
"Statement is TEST in FSM_GENERATION transitions",
440 return returned_statement;
456 entity loop_entity = NULL;
465 pips_assert(
"Statement is UNSTRUCTURED in FSM_GENERATION",
502 loop_instruction,
NIL,NULL,
520 sequence_instruction,
NIL,NULL,
525 return returned_statement;
544 pips_debug(2,
"\nFSMize: Module statement: =====================================\n");
564 statement true_statement, new_true_statement;
565 statement false_statement, new_false_statement;
571 true_statement =
test_true (current_test);
573 if (new_true_statement != NULL) {
574 test_true (current_test) = new_true_statement;
580 if (new_false_statement != NULL) {
581 test_false (current_test) = new_false_statement;
593 if (new_stat != NULL) {
617 if (state_variable == NULL) {
618 entity new_state_variable;
619 int state_variable_identifier
623 pips_debug(2,
"Creating state variable with identifier %d\n",
624 state_variable_identifier);
627 state_variable_identifier);
652 return returned_statement;
evaluation make_evaluation_before(void)
call make_call(entity a1, list a2)
whileloop make_whileloop(expression a1, statement a2, entity a3, evaluation a4)
test make_test(expression a1, statement a2, statement a3)
statement make_statement(entity a1, intptr_t a2, intptr_t a3, string a4, instruction a5, list a6, string a7, extensions a8, synchronization a9)
instruction make_instruction(enum instruction_utype tag, void *val)
synchronization make_synchronization_none(void)
sequence make_sequence(list a)
const char * module_name(const char *s)
Return the module part of an entity name.
#define STATE_VARIABLE_NAME_NO_REF
#define STATE_VARIABLE_NAME
#define CONTROL_MAP(ctl, code, c, list)
Macro to walk through all the controls reachable from a given control node of an unstructured.
#define NIL
The empty list (nil in Lisp)
size_t gen_length(const list l)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
gen_chunk gen_nth(int n, const list l)
to be used as ENTITY(gen_nth(3, l))...
void gen_list_patch(list l, const void *x, const void *y)
Replace all the reference to x in list l by a reference to y:
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
statement make_continue_statement(entity)
bool statement_with_empty_comment_p(statement)
Return true if the statement has an empty statement:
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define MODULE_SEP_STRING
string concatenate(const char *,...)
Return the concatenation of the given strings.
void * gen_find_tabulated(const char *, int)
string statement_type_as_string(statement)
phrase_tools.c
void debug_control(const char *, control, int)
DEBUG FUNCTION: print debugging informations for a control a_control.
int beautify_ordering(int)
Special function made for Ronan Keryell who likes a lot when a integer number is coded on 3 bits :-)
void print_statement(statement)
Print a statement on stderr.
#define EQUAL_OPERATOR_NAME
#define empty_comments
Empty comments (i.e.
#define NON_EQUAL_OPERATOR_NAME
#define ASSIGN_OPERATOR_NAME
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
entity entity_empty_label(void)
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
void AddEntityToDeclarations(entity, entity)
END_EOLE.
entity find_or_create_scalar_entity(const char *, const char *, tag)
Looks for an entity which should be a scalar of the specified basic.
#define statement_ordering(x)
#define CONTROL(x)
CONTROL.
#define EXPRESSION(x)
EXPRESSION.
#define statement_label(x)
@ is_instruction_unstructured
@ is_instruction_whileloop
@ is_instruction_sequence
#define instruction_tag(x)
#define statement_domain_number(x)
#define sequence_statements(x)
#define statement_extensions(x)
#define instruction_sequence(x)
#define control_successors(x)
#define test_condition(x)
#define unstructured_entry(x)
#define statement_instruction(x)
#define statement_comments(x)
#define control_statement(x)
#define instruction_test(x)
#define statement_number(x)
#define instruction_unstructured(x)
#define entity_domain
newgen_syntax_domain_defined
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
static statement current_statement
The structure used to build lists in NewGen.