PIPS
|
#include <stdio.h>
#include <strings.h>
#include <string.h>
#include "linear.h"
#include "genC.h"
#include "ri.h"
#include "ri-util.h"
#include "workspace-util.h"
#include "control.h"
#include "pipsdbm.h"
#include "text-util.h"
#include "resources.h"
#include "properties.h"
#include "misc.h"
Go to the source code of this file.
Functions | |
static statement | update_unstructured_declarations (statement module_stat) |
FI: a short-term solution to fix declarations lost due to unstructured building by controlizer. More... | |
bool | new_controlizer (const char *module_name) |
Transform a code with some goto and labels (typically generated by a parser) into a code that is a hierarchical control flow graph, the standard abstract syntax tree of PIPS (the RI). More... | |
bool | controlizer (const char *module_name) |
The old controlizer user interface. More... | |
bool controlizer | ( | const char * | module_name | ) |
The old controlizer user interface.
Transform a code with some goto and labels (typically generated by a parser) into a code that is a hierarchical control flow graph, the standard abstract syntax tree of PIPS (the RI).
Interface for pipsdbm and pipsmake
Should never arise
To have the debug in unspaghettify_statement() working:
The statement of a compilation unit is a long list of continue statements and it takes a long time to restructure although nothing is done in the end. So, let's skip this useless processing. SG:it may be ok to skip it, but we still need to call module_reorder ...
gen_copy_seq(statement_declarations(parsed_mod_stat))
By setting this property, we try to unspaghettify the control graph of the module:
With C code, some local declarations may have been lost by the (current) restructurer
Reorder the module, because we have a new statement structure.
module_name | odule_name |
Definition at line 224 of file module.c.
References c_module_p(), code_language, compilation_unit_p(), control_graph(), copy_statement(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, empty_comments, empty_extensions(), entity_empty_label(), entity_initial, entity_undefined_p, get_bool_property(), ifdebug, is_instruction_unstructured, is_language_fortran, language_tag, make_instruction(), MAKE_ORDERING, make_statement(), make_synchronization_none(), module_name(), module_name_to_entity(), module_reorder(), new_controlizer(), NIL, pips_assert, pips_user_warning, reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), set_prettyprint_language_from_property(), statement_consistent_p(), STATEMENT_NUMBER_UNDEFINED, unspaghettify_statement(), update_unstructured_declarations(), USE_NEW_CONTROLIZER_ENV_VAR_NAME, value_code, and value_code_p.
Referenced by AddEntityToCompilationUnit(), new_controlizer(), outliner_independent(), and RemoveEntityFromCompilationUnit().
bool new_controlizer | ( | const char * | module_name | ) |
Transform a code with some goto and labels (typically generated by a parser) into a code that is a hierarchical control flow graph, the standard abstract syntax tree of PIPS (the RI).
module.c
Interface for pipsdbm and pipsmake
Should never happen
To have the debug in unspaghettify_statement() working:
The statement of a compilation unit is a long list of continue statements and it takes a long time to restructure although nothing is done in the end. So, let's skip this useless processing. SG:it may be ok to skip it, but we still need to call module_reorder ...
By setting this property, we try to unspaghettify the control graph of the module:
With C code, some local declarations may have been lost by the (current) restructurer. FI: not investigated; should be useless by now..
Reorder the module, because we have a new statement structure.
module_name | odule_name |
Definition at line 102 of file module.c.
References c_module_p(), code_language, compilation_unit_p(), controlizer(), copy_statement(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, entity_initial, entity_undefined_p, forloop_domain, gen_recurse, gen_true(), get_bool_property(), hcfg(), ifdebug, is_language_fortran, language_tag, module_name(), module_name_to_entity(), module_reorder(), pips_assert, pips_user_warning, reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), set_prettyprint_language_from_property(), statement_consistent_p(), statement_domain, transform_a_for_loop_statement_into_a_while_loop(), try_to_transform_a_for_loop_into_a_do_loop(), unspaghettify_statement(), update_unstructured_declarations(), USE_OLD_CONTROLIZER_ENV_VAR_NAME, value_code, and value_code_p.
Referenced by controlizer().
FI: a short-term solution to fix declarations lost due to unstructured building by controlizer.
Get all the declarations found (recursively) in the module
Get all the entities referenced in the module
To preserve the order, it would be better to collect variables and functions at the same time with a statement_to_referenced_or_called_entities()
Build a list of entities that are not declared anywhere:
Definition at line 49 of file module.c.
References code_declarations, CONS, ENDP, ENTITY, entity_initial, formal_parameter_p(), gen_free_list(), gen_in_list_p(), gen_nconc(), get_current_module_entity(), ifdebug, make_block_statement(), MAP, member_entity_p(), module_entity_to_compilation_unit_entity(), NIL, pips_debug, print_entities(), STATEMENT, statement_block_p, statement_declarations, statement_to_called_user_entities(), statement_to_declarations(), statement_to_referenced_entities(), statement_unstructured_p(), and value_code.
Referenced by controlizer(), and new_controlizer().