2 #include "pips_config.h"
13 #include "resources.h"
242 dssrhp p = { var, fields, new_vars };
524 pips_user_warning(
"case unhandled, this would require an atomization in fortran i guess\n");
541 pips_user_warning(
"case unhandled, this would require an atomization in fortran i guess\n");
635 char buf[] = {
'\'', *string_constant,
'\'', 0 };
639 free(string_constant);
void free_normalized(normalized p)
basic make_basic_complex(intptr_t _field_)
value make_value_unknown(void)
value make_value_expression(expression _field_)
sizeofexpression make_sizeofexpression_expression(expression _field_)
expression make_expression(syntax a1, normalized a2)
syntax make_syntax_sizeofexpression(sizeofexpression _field_)
ram make_ram(entity a1, entity a2, intptr_t a3, list a4)
expression copy_expression(expression p)
EXPRESSION.
reference make_reference(entity a1, list a2)
bool statement_consistent_p(statement p)
basic make_basic_float(intptr_t _field_)
dimension make_dimension(expression a1, expression a2, list a3)
instruction make_instruction_sequence(sequence _field_)
void free_expression(expression p)
void free_storage(storage p)
void free_syntax(syntax p)
storage make_storage_ram(ram _field_)
sequence make_sequence(list a)
syntax make_syntax_reference(reference _field_)
struct _newgen_struct_expression_ * expression
struct _newgen_struct_statement_ * statement
expression MakeCharacterConstantExpression(string s)
END_EOLE.
expression MakeComplexConstantExpression(expression r, expression i)
int dummy
A dummy file, to prevent empty libraries from breaking builds.
const char * module_name(const char *s)
Return the module part of an entity name.
void cleanup_subscripts(void *)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
#define gen_recurse(start, domain_number, flt, rwt)
void gen_full_free_list(list l)
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
void reset_current_module_entity(void)
Reset the current module entity.
void reset_current_module_statement(void)
Reset the current module statement.
const char * get_current_module_name(void)
Get the name of the current module.
statement set_current_module_statement(statement)
Set the current module statement.
statement get_current_module_statement(void)
Get the current module statement.
entity set_current_module_entity(entity)
static.c
entity get_current_module_entity(void)
Get the entity of the current module.
void gen_recurse_stop(void *obj)
Tells the recursion not to go in this object.
void gen_multi_recurse(void *o,...)
Multi recursion visitor function.
gen_chunk * gen_get_ancestor(int, const void *)
return the first ancestor object found of the given type.
gen_chunk * gen_get_recurse_ancestor(const void *)
Get the first ancestor object encountered during the recursion for the given object.
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
bool gen_true2(__attribute__((unused)) gen_chunk *u1, __attribute__((unused)) void *u2)
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
instruction make_call_instruction(entity e, list l)
Build an instruction that call a function entity with an argument list.
#define ENDP(l)
Test if a list is empty.
list gen_nreverse(list cp)
reverse a list in place
#define POP(l)
Modify a list pointer to point on the next element of the list.
#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)
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
#define CAR(pcons)
Get the value of the first element of a list.
void gen_free_list(list l)
free the spine of the list
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
list gen_append(list l1, const list l2)
list gen_full_copy_list(list l)
Copy a list structure with element copy.
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
statement make_assign_statement(expression, expression)
bool return_statement_p(statement)
Test if a statement is a C or Fortran "return".
void insert_statement(statement, statement, bool)
This is the normal entry point.
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
#define pips_user_warning
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define DYNAMIC_AREA_LOCAL_NAME
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
#define make_expression_list(stats...)
#define binary_call_rhs(c)
#define ENTITY_FIVE_OPERATION_P(e)
#define MINUS_OPERATOR_NAME
#define ENTITY_DEREFERENCING_P(e)
#define POINT_TO_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define ENTITY_POINT_TO_P(e)
#define statement_block_p(stat)
#define INSTANCE_OF(type, value)
polymorhism thanks to newgen !
#define FIELD_OPERATOR_NAME
#define DEFAULT_COMPLEX_TYPE_SIZE
#define MEMCPY_FUNCTION_NAME
include <string.h>
#define entity_declarations(e)
MISC: newgen shorthands.
#define ENTITY_PLUS_C_P(e)
#define entity_variable_p(e)
An entity_variable_p(e) may hide a typedef and hence a functional type.
#define ENTITY_FIELD_P(e)
C data structure and pointer management.
#define SQRT_OPERATOR_NAME
#define ENTITY_MINUS_C_P(e)
#define binary_call_lhs(c)
#define UNARY_PLUS_OPERATOR_NAME
#define ENTITY_C_RETURN_P(e)
#define AIMAG_CONVERSION_NAME
#define ENTITY_ADDRESS_OF_P(e)
#define REAL_GENERIC_CONVERSION_NAME
#define module_functional_parameters(func)
#define MULTIPLY_OPERATOR_NAME
#define ENTITY_RETURN_P(e)
entity FindEntity(const char *package, const char *name)
Retrieve an entity from its package/module name and its local name.
bool same_entity_p(entity e1, entity e2)
predicates on entities
code entity_code(entity e)
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
basic entity_basic(entity e)
return the basic associated to entity e if it's a function/variable/constant basic_undefined otherwis...
static int init
Maximal value set for Fortran 77.
entity CreateIntrinsic(string name)
this function does not create an intrinsic function because they must all be created beforehand by th...
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
entity make_entity_copy_with_new_name(entity e, string global_new_name, bool move_initialization_p)
Create a copy of an entity, with (almost) identical type, storage and initial value if move_initializ...
expression reference_to_expression(reference r)
bool expression_call_p(expression e)
expression float_to_expression(float c)
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
bool expression_string_constant_p(expression exp)
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
call expression_call(expression e)
void update_expression_syntax(expression e, syntax s)
frees expression syntax of e and replace it by the new syntax s
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
expression MakeUnaryCall(entity f, expression a)
Creates a call expression to a function with one argument.
bool expression_reference_p(expression e)
Test if an expression is a reference.
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
char * expression_string_constant(expression exp)
returns a newly allocated string!
basic basic_of_expression(expression)
basic basic_of_expression(expression exp): Makes a basic of the same basic as the expression "exp".
void AddLocalEntityToDeclarations(entity, entity, statement)
Add the variable entity e to the list of variables of the function module.
bool entity_scalar_p(entity)
The concrete type of e is a scalar type.
entity make_new_scalar_variable(entity, basic)
void AddEntityToCurrentModule(entity)
Add a variable entity to the current module declarations.
bool formal_parameter_p(entity)
entity make_new_scalar_variable_with_prefix(const char *, entity, basic)
Create a new scalar variable of type b in the given module.
int add_variable_to_area(entity, entity)
bool type_struct_variable_p(type)
bool type_pointer_on_struct_variable_p(type)
#define dummy_identifier(x)
#define normalized_undefined
#define expression_domain
newgen_execution_domain_defined
#define parameter_dummy(x)
#define basic_complex_p(x)
#define syntax_reference(x)
#define reference_undefined
#define reference_variable(x)
#define subscript_domain
newgen_storage_domain_defined
#define basic_pointer_p(x)
#define entity_storage(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define code_declarations(x)
#define call_domain
newgen_callees_domain_defined
#define basic_overloaded_p(x)
#define EXPRESSION(x)
EXPRESSION.
#define subscript_indices(x)
#define expression_undefined
#define expression_normalized(x)
struct _newgen_struct_syntax_ * syntax
#define PARAMETER(x)
PARAMETER.
#define reference_indices(x)
#define instruction_call_p(x)
#define instruction_expression(x)
#define expression_undefined_p(x)
#define subscript_array(x)
#define variable_dimensions(x)
#define code_decls_text(x)
#define statement_declarations(x)
#define statement_instruction(x)
#define instruction_call(x)
#define call_arguments(x)
#define value_expression_p(x)
#define expression_syntax(x)
#define dummy_identifier_p(x)
#define value_expression(x)
#define variable_basic(x)
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
Value b1
booleen indiquant quel membre est en cours d'analyse
static void reset_translation_mode()
static void do_split_structure_return_hook_walker(statement s, dssrhp *p)
static list do_split_structure(entity e, statement s)
static void do_simplify_constant_address_expression(expression exp)
perform constant string dereferencing evaluation
static void simplify_complex_entity(entity c)
adds a dimension to all entity whose basic is complex , and change their basic to float
bool simplify_constant_address_expressions(const char *module_name)
transforms *"aer" into 'a' do not take care of "aer"[2] but could be extended to
bool simplify_complex(const char *module_name)
split complexes into an array with first element <> real part and second element <> imaginary part
static void do_simplify_subscripts(statement s)
static void replace_field_by_reference_walker(call c, rfr_param *p)
static void entity_used_in_calls_walker(call c, entity_used_in_calls_p *p)
static void do_simplify_constant_address_expression_in_decl(statement st)
forward processing through declarations
static instruction make_fields_assignment_instruction(entity var, list fields, list new_vars)
static void set_translation_mode()
bool split_structures(const char *module_name)
static void(* complex_translation)(list *, list)
static bool has_address_of_operator_p(expression exp)
look for an & in the expression
static void reset_the_i()
bool simplify_subscripts(const char *module_name)
atomize subscript expressions so that thay can be reprsetned as references
static void do_split_structure_return_hook(entity var, list fields, list new_vars)
expression make_float_constant_expression(float)
static void simplify_complex_statements(statement s)
static void do_split_structures(statement s)
void complex_translation_array_of_structs(list *pl, list l)
static bool simplify_complex_expression(expression e)
static bool has_address_of_operator_walker_p(call c, bool *panswer)
static bool entity_used_in_calls(entity e)
static void do_simplify_c_operator(call c)
static void simplify_subscript(subscript ss)
the walker
void complex_translation_struct_of_array(list *pl, list l)
static void do_split_structure_parameter(entity e)
void simplify_c_operator(statement s)
replace PLUS_C_OPERATOR_NAME by PLUS_OPERATOR_NAME when relevant
static expression split_complex_expression(expression e)
static void simplify_complex_declaration(entity e)
static void replace_field_by_reference(entity structure, entity field, entity new)
The structure used to build lists in NewGen.
A gen_chunk is used to store every object.
#define exp
Avoid some warnings from "gcc -Wshadow".