25 #include "pips_config.h"
109 for (i = 1; i <= nparams; i++) {
278 bool prettyprint_common_variable_dimensions_p,
348 case 1: pn =
"PRETTYPRINT_C_CHAR_TYPE";
350 case 2: pn =
"PRETTYPRINT_C_SHORT_TYPE";
352 case 4: pn =
"PRETTYPRINT_C_INT_TYPE";
354 case 6: pn =
"PRETTYPRINT_C_LONG_TYPE";
356 case 8: pn =
"PRETTYPRINT_C_LONGLONG_TYPE";
358 case 9: pn =
"PRETTYPRINT_C_INT128_TYPE";
360 case 11: pn =
"PRETTYPRINT_C_UCHAR_TYPE";
362 case 12: pn =
"PRETTYPRINT_C_USHORT_TYPE";
364 case 14: pn =
"PRETTYPRINT_C_UINT_TYPE";
366 case 16: pn =
"PRETTYPRINT_C_ULONG_TYPE";
368 case 18: pn =
"PRETTYPRINT_C_ULONGLONG_TYPE";
370 case 19: pn =
"PRETTYPRINT_C_UINT128_TYPE";
372 case 21: pn =
"PRETTYPRINT_C_SCHAR_TYPE";
374 case 22: pn =
"PRETTYPRINT_C_SSHORT_TYPE";
376 case 24: pn =
"PRETTYPRINT_C_SINT_TYPE";
378 case 26: pn =
"PRETTYPRINT_C_SLONG_TYPE";
380 case 28: pn =
"PRETTYPRINT_C_SLONGLONG_TYPE";
788 if(!initial_p && late_p && !
ENDP(pc))
945 spacer = space_p ?
", " :
",";
985 add_dummy_parameter_name_p,
986 true,
false,
false, ppdl);
1037 pips_debug(9,
"Function type with name = \"%s\" and length %zd\n",
1058 for(cparam =
lparams, pnum = 1; !
ENDP(cparam);
POP(cparam), pnum++) {
1065 if(add_dummy_parameter_name_p
1085 is_safe,
false,
true,in_type_declaration,
true, ppdl));
1093 is_first, in_type_declaration,
1127 is_first, in_type_declaration,
1134 bool qualifiers_p =
false;
1135 if (
false && ( is_first || in_type_declaration )
1139 qualifiers_p =
true;
1141 else if (
false && ( is_first || in_type_declaration )
1148 pips_debug(9,
"Basic type with name = \"%s\"\n", sname);
1158 if(strlen(sname)!=0 && is_first)
1202 if(pc!=
NIL && !qualifiers_p)
1207 is_safe,
false, is_first,
1208 in_type_declaration,
1246 *ppdl =
gen_once((
void *) ent, *ppdl);
1251 add_dummy_parameter_name_p,
1252 is_first, in_type_declaration,
1280 pips_debug(9,
"Typedef type with name = \"\%s\"\n",
1306 pips_debug(9,
"Struct type ... with name = %s\n", sname);
1319 for(cl = l; !
ENDP(cl);
POP(cl)) {
1338 pips_debug(9,
"Union type ... with name = %s\n", sname);
1348 for(cl = l; !
ENDP(cl);
POP(cl)) {
1368 pips_debug(9,
"Enum type ... with name = %s\n", sname);
1378 for(cl = l; !
ENDP(cl);
POP(cl)) {
1411 in_type_declaration,
false, ppdl);
1485 *ppdl =
gen_once((
void *) de, *ppdl);
1547 for(cl = l; !
ENDP(cl);
POP(cl)) {
1604 is_first, in_type_declaration, ppdl));
1676 bool foif_p = !
ENDP(*pcl);
1720 pips_debug(8,
"Intermediate declaration list: ");
1735 bool match_p =
false;
1781 pips_assert(
"The control list is empty or the two lists have the same "
1782 "number of elements",
1837 bool skip_first_comma_p =
true;
1839 bool place_holder_p =
false;
1844 place_holder_p =
true;
1854 pips_debug(5,
"Print declaration for first entity %s in module %s\n",
1867 bool extern_p =
false;
1868 bool dummy_p =
false;
1872 extern_p = (ic==1 || ic==3)?
true :
false;
1923 bool in_type_declaration =
true;
1976 *ppdl =
gen_once((
void *) e1, *ppdl);
1977 pc =
words_enum(name1, l, space_p, pc, ppdl);
1995 in_type_declaration=
false;
1997 bool init_p = extern_p?
false :
true;
2001 init_p = ic==1?
true :
false;
2005 in_type_declaration, ppdl, init_p);
2008 skip_first_comma_p =
false;
2032 if(skip_first_comma_p) {
2033 skip_first_comma_p =
false;
2042 init_p = ic==1?
true :
false;
2049 string asm_qual =
strdup(
"");
type copy_type(type p)
TYPE.
unformatted make_unformatted(string a1, intptr_t a2, intptr_t a3, list a4)
sentence make_sentence(enum sentence_utype tag, void *val)
string list_to_string(list l)
Return the malloc()ed version of the concatenation of all the strings in the list.
void attach_declaration_to_words(list l, entity e)
Attach a declaration to all the words of the given list:
#define ret(why, what)
true if not a remapping for old.
char * get_string_property(const char *)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
void gen_full_free_list(list l)
entity get_current_module_entity(void)
Get the entity of the current module.
#define ENDP(l)
Test if a list is empty.
#define POP(l)
Modify a list pointer to point on the next element of the list.
#define NIL
The empty list (nil in Lisp)
list gen_once(const void *vo, list l)
Prepend an item to a list only if it is not already in the list.
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
list gen_last(list l)
Return the last element of a list.
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
#define CDR(pcons)
Get the list less its first element.
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
gen_chunk gen_nth(int n, const list l)
to be used as ENTITY(gen_nth(3, l))...
#define list_undefined
Undefined list definition :-)
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
bool prettyprint_language_is_c_p()
enum language_utype get_prettyprint_language_tag()
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_user_warning
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
#define DUMMY_STRUCT_PREFIX
#define DUMMY_ENUM_PREFIX
For enum and struct and union without names (see c_syntax/cyacc.y)
#define DUMMY_MEMBER_PREFIX
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
#define DUMMY_UNION_PREFIX
#define MEMBER_SEP_STRING
char * i2a(int)
I2A (Integer TO Ascii) yields a string for a given Integer.
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define same_string_p(s1, s2)
string string_buffer_to_string(const string_buffer)
return malloc'ed string from string buffer sb
void string_buffer_free(string_buffer *)
free string buffer structure, also free string contents according to the dup field
string_buffer string_buffer_make(bool dup)
allocate a new string buffer
#define string_undefined_p(s)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
int f2(int off1, int off2, int w, int n, float r[n], float a[n], float b[n])
list Words_Type(type obj)
list generic_c_words_entity(type t, list name, bool is_safe, bool add_dummy_parameter_name_p, list *ppdl)
This recursive function prints a C variable with its type.
static list words_variable_or_function(entity module, entity e, bool is_first, list pc, bool in_type_declaration, list *ppdl, bool init_p)
static list words_parameters(entity e, list *ppdl)
text c_text_related_entities(entity module, list del, int margin, int sn, list *ppdl, list cl)
It is assumed that all entities in list el can be declared by an unique statement,...
text c_text_entities(entity module, list ldecl, int margin, list *ppdl)
Generate declarations for a list of entities belonging to the same statement declaration.
static list words_enum_reference(const char *name1, list pc, bool init_p)
Prolog to print out a struct definition, such as "struct s { int a; int b;}"; for the time being,...
list words_basic(basic obj, list *ppdl)
what about simple DOUBLE PRECISION, REAL, INTEGER...
text c_text_entity(entity module, entity e, int margin, list *ppdl, bool init_p)
Regeneration of declarations from the symbol table.
list safe_c_words_entity(type t, list name)
static list words_constant(constant obj)
list c_words_simplified_entity(type t, list name, bool is_first, bool in_type_declaration, list *ppdl)
The declaration list pointer ppdl is passed down to determine if an internal derived type must be ful...
sentence sentence_variable(entity e, list *ppdl)
text c_text_entity_simple(entity module, entity e, int margin)
static list words_late_qualifiers(list obj)
static list words_enum(const char *name1, list l, bool space_p, list pc, list *ppdl)
list generic_c_words_simplified_entity(type t, list name, bool is_safe, bool add_dummy_parameter_name_p, bool is_first, bool in_type_declaration, bool argument_p, list *ppdl)
Same as above, but the bool is_first is used to skip a type specifier which is useful when several va...
sentence Sentence_Variable(entity e)
static list words_dimension(dimension obj, list *ppdl)
list words_declaration(entity e, bool prettyprint_common_variable_dimensions_p, list *ppdl)
some compilers don't like dimensions that are declared twice.
sentence sentence_head(entity e, list *ppdl)
We have no way to distinguish between the SUBROUTINE and PROGRAM They two have almost the same proper...
list words_qualifiers(list obj)
static list words_union(const char *name1, list pc, bool init_p)
list words_type(type obj, list *ppdl, bool argument_p)
obj is the type to describe
list words_dimensions(list dims, list *ppdl)
static list words_value(value obj)
list c_words_entity(type t, list name, list *ppdl)
static list filtered_declaration_list(list del, list *pcl)
Fix the declaration list produced by the parser, which includes declared program variables but also d...
static list words_initial_qualifiers(list obj)
list words_brace_expression(expression exp, list *ppdl)
bool c_brace_expression_p(expression e)
static list words_struct_reference(const char *name1, list pc, bool init_p)
To print out a struct reference, such as "struct s".
static list generic_words_qualifiers(list obj, bool initial_p, bool late_p)
================C prettyprinter functions=================
list words_subexpression(expression obj, int precedence, bool leftmost, list *ppdl)
exported for cmfortran.c
list words_expression(expression obj, list *ppdl)
This one is exported.
static bool argument_p(entity e)
This function return a bool indicating if related entity e represents an argument.
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
list lparams
Array bounds.
#define binary_call_rhs(c)
#define ENTITY_MINUS_P(e)
#define ENTITY_BRACE_INTRINSIC_P(e)
C initialization expression.
#define ENTITY_MINUS_C_P(e)
#define binary_call_lhs(c)
#define ASSIGN_OPERATOR_PRECEDENCE
bool static_area_p(entity aire)
void dump_functional(functional f, string_buffer result)
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
bool entity_struct_p(entity e)
Is entity e the entity corresponding to a struct declaration?
bool entity_main_module_p(entity e)
bool entity_enum_p(entity e)
void print_entities(list l)
list entity_qualifiers(entity e)
return the qualifiers associated to entity e if it's a variable NIL otherwise
bool entity_blockdata_p(entity e)
bool entity_module_p(entity e)
bool type_used_in_type_declarations_p(entity e, list ldecl)
check if e is used to declare one of the entities in entity list ldecl
bool entity_f95module_p(entity e)
entity CreateIntrinsic(string name)
this function does not create an intrinsic function because they must all be created beforehand by th...
bool derived_entity_p(entity e)
bool entity_union_p(entity e)
Is entity e an entity representing the union declaration?
bool expression_integer_value(expression e, intptr_t *pval)
bool expression_call_p(expression e)
int expression_to_int(expression exp)
================================================================
constant expression_constant(expression exp)
This function returns a "constant" object if the expression is a constant such as 10,...
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...
bool brace_expression_p(expression e)
Return bool indicating if expression e is a brace expression.
bool unbounded_dimension_p(dimension dim)
bool unbounded_dimension_p(dim) input : a dimension of an array entity.
int integer_constant_expression_value(expression e)
bool static_module_p(entity e)
Check if the given module entity is a static module.
bool compilation_unit_entity_p(entity e)
Check if the given module entity is a compilation unit.
bool formal_label_replacement_p(entity)
bool qualifiers_restrict_p(list)
Check that a qualifier list contains the restrict qualifier.
bool variable_in_common_p(entity)
true if v is in a common.
bool place_holder_variable_p(entity)
bool qualifiers_const_p(list)
Check that a qualifier list contains the const qualifier.
bool overloaded_parameters_p(list)
type type_to_final_pointed_type(type)
returns t if t is not a pointer type, and the first indirectly pointed type that is not a pointer if ...
bool basic_type_p(type)
Safer than the other implementation? bool pointer_type_p(type t) { bool is_pointer = false;.
bool declarable_type_p(type, list)
Are all types necessary to define fully type "t" listed in list "pdl"?
bool pointer_type_p(type)
Check for scalar pointers.
bool derived_type_p(type)
Returns true if t is of type struct, union or enum.
bool implicit_c_variable_p(entity)
bool typedef_type_p(type)
Returns true if t is a typedefED type.
bool variable_static_p(entity)
true if v appears in a SAVE statement, or in a DATA statement, or is declared static i C.
entity find_ith_parameter(entity, int)
#define type_functional_p(x)
#define value_undefined_p(x)
#define dummy_identifier(x)
#define functional_result(x)
#define storage_formal_p(x)
#define parameter_dummy(x)
#define parameter_type(x)
#define value_constant(x)
#define type_unknown_p(x)
#define QUALIFIER(x)
QUALIFIER.
#define symbolic_constant(x)
#define type_functional(x)
#define value_unknown_p(x)
#define dimension_lower(x)
#define basic_derived_p(x)
#define entity_storage(x)
#define type_statement_p(x)
#define value_constant_p(x)
#define qualifier_asm_p(x)
#define value_symbolic(x)
#define basic_undefined_p(x)
#define EXPRESSION(x)
EXPRESSION.
#define type_undefined_p(x)
#define dummy_unknown_p(x)
#define entity_undefined_p(x)
#define constant_int_p(x)
#define expression_undefined
#define value_symbolic_p(x)
#define functional_parameters(x)
#define code_initializations(x)
#define PARAMETER(x)
PARAMETER.
#define sequence_statements(x)
#define dimension_upper(x)
#define variable_qualifiers(x)
#define instruction_expression(x)
#define type_varargs_p(x)
#define variable_dimensions(x)
#define statement_instruction(x)
#define call_arguments(x)
@ is_qualifier_static_dimension
#define dimension_qualifiers(x)
#define value_expression_p(x)
#define expression_syntax(x)
#define type_variable_p(x)
#define symbolic_expression(x)
#define value_expression(x)
#define variable_basic(x)
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
static int lname(char *s, int look_for_entry)
check for keywords for subprograms return 0 if comment card, 1 if found name and put in arg string.
internally defined structure.
The structure used to build lists in NewGen.
#define CHAIN_SWORD(l, s)
#define MERGE_TEXTS(r, t)
#define MAKE_ONE_WORD_SENTENCE(m, s)
#define CHAIN_IWORD(l, i)
#define ADD_SENTENCE_TO_TEXT(t, p)
void add_words_to_text(text, list)
Add the word list wl to the end of the last sentence of text t.
#define text_sentences(x)
@ is_sentence_unformatted
#define exp
Avoid some warnings from "gcc -Wshadow".