25 #include "pips_config.h"
47 #include "resources.h"
103 "This is not supported by PIPS. Please rename %s\n",
112 "function and an intrinsic\n");
175 fprintf(stderr,
"Declaration list: ");
233 labeled_statement = s;
241 labeled_statement = smt;
292 pips_debug(7,
"Label %s already exists\n", s);
447 comment_after_for_clause,
449 free(comment_after_for_clause);
450 free(comment_before_for_clause);
545 printf(
"Number of statements in the block: %zd\n", len);
650 for(ct=tl;!
ENDP(ct);
POP(ct)) {
736 asprintf(&estr,
"%lld", (
long long int) val);
752 *(estr+strlen(estr)-1) =
'\000';
758 "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_abcdefghijklmnopqrstuvwxyz")!=strlen(restr) && *estr==
'\'') {
762 if(strlen(restr)==1) {
768 else if(*restr==
'\\') {
769 if(*(restr+1)==
'0'||*(restr+1)==
'1'||*(restr+1)==
'2'||*(restr+1)==
'3')
772 else if(*(restr+1)==
'x'||*(restr+1)==
'u'||*(restr+1)==
'U')
782 else if(*(restr+1)==
'b')
784 else if(*(restr+1)==
'f')
786 else if(*(restr+1)==
'n')
788 else if(*(restr+1)==
't')
790 else if(*(restr+1)==
'r')
792 else if(*(restr+1)==
'v')
794 else if(*(restr+1)==
'\'')
796 else if(*(restr+1)==
'\"')
798 else if(*(restr+1)==
'\\')
800 else if(*(restr+1)==
'\?')
956 for(i=0;i<dn-1;i++) {
963 pips_assert(
"Same number of elements in both lists",
1000 (is_dummy_statement_p? 2 : 0));
1005 fprintf(stderr,
"Variable \"%s\" is %sdeclared EXTERN.\n",
entity_user_name(first), is_extern_statement_p?
"" :
"not ");
1006 fprintf(stderr,
"Number of declared variables: %d\n", dn);
1008 fprintf(stderr,
"Number of initialization expressions: %d\n", in);
1026 fprintf(stderr,
"**************************\n");
call make_call(entity a1, list a2)
instruction make_instruction_forloop(forloop _field_)
storage make_storage_rom(void)
instruction make_instruction_expression(expression _field_)
value make_value(enum value_utype tag, void *val)
bool statement_consistent_p(statement p)
test make_test(expression a1, statement a2, statement a3)
bool forloop_consistent_p(forloop p)
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_sequence(sequence _field_)
code make_code(list a1, string a2, sequence a3, list a4, language a5)
void free_expression(expression p)
language make_language_c(void)
instruction make_instruction(enum instruction_utype tag, void *val)
constant make_constant_litteral(void)
list gen_statement_cons(statement p, list l)
synchronization make_synchronization_none(void)
sequence make_sequence(list a)
void free_statement(statement p)
forloop make_forloop(expression a1, expression a2, expression a3, statement a4)
void free_sequence(sequence p)
void const char const char const int
string get_current_C_comment(void)
Return the current comment as a string to be freed by the caller and reset the current comment.
#define c_parser_user_warning(...)
void discard_C_comment(void)
Discard a C comment because we don't know how to deal with it.
#define get_label_prefix()
The labels in C have function scope...
int get_current_C_line_number(void)
string pop_current_C_comment(void)
Pop the current comment.
int pop_current_C_line_number(void)
entity MakeCLabel(string s)
static bool dummy_declaration_p
void set_prettyprint_control_list_to_extern(statement s)
statement ExpressionToStatement(expression e)
e is now owned by returned statement
statement MakeForloopWithIndexDeclaration(list decls, expression e2, expression e3, statement body)
Create a C99 for-loop statement with a declaration as first parameter in the for clause,...
statement MakeBreakStatement(string cmt)
static forloop find_forloop_in_statement(statement s)
Because a break in the forloop requires the generation of an extra label statement after the forloop.
statement MakeContinueStatement(string cmt)
stack SwitchControllerStack
statement FindStatementFromLabel(entity l)
statement MakeWhileLoop(list lexp, statement s, bool before)
void set_prettyprint_control_list_to_dummy(void)
list LabeledStatements
BlockStack is used to handle block scope.
void MakeCurrentModule(entity e)
is used for switch statements also, because we do not distinguish a break in a loop or a switch
statement MakeDefaultStatement()
void ResetCurrentModule()
stack SwitchGotoStack
list of labeled statements of the current module
stack BlockStack
Attention, the null statement in C is represented as the continue statement in Fortran (make_continue...
statement MakeForloop(expression e1, expression e2, expression e3, statement body)
Create a for-loop statement with some parser-specific characteristics.
statement MakeLabeledStatement(string label, statement s, string comment)
Construct a new statement from.
bool extern_prettyprint_control_list_p(void)
void reset_prettyprint_control_list_to_extern(void)
bool dummy_prettyprint_control_list_p(void)
Provide the information only once.
statement MakeCaseStatement(expression e)
Transform.
statement MakeSwitchStatement(statement s)
list add_prettyprint_control_list_to_declaration_statement(statement s, list initialization_expressions)
The control list is hidden as arguments to the call to CONTROL in the declaration statement s.
static bool extern_declaration_p
Force declaration statement s to be an extern declaration.
statement MakeGotoStatement(string label)
void set_prettyprint_control_list_to_extern(void)
statement MakeBlock(list stmts)
Create a block statement.
void init_c_areas(void)
In C we have 4 areas.
void CModuleMemoryAllocation(entity)
This function is for MemoryAllocation for Module of C programs.
void init_c_implicit_variables(entity)
void CCleanLocalEntities(entity function)
C language version.
static list initialization_expressions
to preserve information about the declarations for the prettyprinter, especially for the global varia...
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
static void comment(string_buffer code, spoc_hardware_type hw, dagvtx v, int stage, int side, bool flip)
void gen_full_free_list(list l)
void CParserError(char *msg)
statement make_block_statement(list body)
Make a block statement from a list of statement.
statement instruction_to_statement(instruction instr)
Build a statement from a give instruction.
void reset_current_module_entity(void)
Reset the current module entity.
const char * get_current_module_name(void)
Get the name of the current module.
entity set_current_module_entity(entity)
static.c
entity get_current_module_entity(void)
Get the entity of the current module.
#define ENDP(l)
Test if a list is empty.
list gen_nreverse(list cp)
reverse a list in place
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
#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.
#define CDR(pcons)
Get the list less its first element.
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)
list statement_block(statement s)
Get the list of block statements of a statement sequence.
call statement_call(statement s)
Get the call of a statement.
forloop statement_forloop(statement s)
Get the forloop of a statement.
bool unlabelled_statement_p(statement st)
bool statement_forloop_p(statement s)
statement add_initialization_information_to_declaration_statement(statement s, list iel)
The initialization expression list is integrated into the internal representation as an argument list...
void append_statement_to_block_statement(statement b, statement s)
void insert_comments_to_statement(statement s, const char *the_comments)
Insert a comment string (if non empty) at the beginning of the comments of a statement.
statement make_whileloop_statement(expression condition, statement body, int line_number, bool before)
Build a while loop statement.
statement add_comment_and_line_number(statement s, string sc, int sn)
Since block cannot carry comments nor line numbers, they must be moved to an internal continue statem...
void insert_statement(statement s, statement s1, bool before)
This is the normal entry point.
statement make_continue_statement(entity l)
list statements_to_direct_declarations(list sl)
Returns the declarations contained directly in the declaration statements of a list of statements.
statement add_label_to_statement(entity label, statement s, statement *labeled_statement)
Add a label to a statement.
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
void set_prettyprint_language_tag(enum language_utype lang)
set the prettyprint language from a language_utype argument
#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 STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
string concatenate(const char *,...)
Return the concatenation of the given strings.
void * stack_head(const stack)
returns the item on top of stack s
void stack_free(stack *)
type, bucket_size, policy
stack stack_make(int, int, int)
allocation
void * stack_pop(stack)
POPs one item from stack s.
#define string_undefined_p(s)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
void print_expressions(list le)
string expression_to_string(expression e)
#define statement_block_p(stat)
#define test_to_statement(t)
#define STATEMENT_NUMBER_UNDEFINED
default values
#define call_to_statement(c)
#define CONTINUE_FUNCTION_NAME
#define empty_comments
Empty comments (i.e.
void split_initializations_in_statement(statement s)
Transform a declaration with an initialization statement into 2 parts, a declaration statement and an...
void fprint_C_environment(FILE *fd, entity m)
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...
entity FindOrCreateEntity(const char *package, const char *local_name)
Problem: A functional global entity may be referenced without parenthesis or CALL keyword in a functi...
bool intrinsic_entity_p(entity e)
bool typedef_entity_p(entity e)
entity entity_empty_label(void)
static int init
Maximal value set for Fortran 77.
void print_entities(list l)
bool derived_entity_p(entity e)
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
bool expression_integer_value(expression e, intptr_t *pval)
expression MakeCommaExpression(list l)
bool expression_cast_p(expression e)
expression make_call_expression(entity e, list l)
Build an expression that call an function entity with an argument list.
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
cast expression_cast(expression e)
bool simplify_C_expression(expression e)
Replace C operators "+C" and "-C" which can handle pointers by arithmetic operators "+" and "-" when ...
expression call_to_expression(call c)
Build an expression that call a function or procedure.
extensions empty_extensions(void)
extension.c
type MakeTypeStatement(void)
#define value_undefined_p(x)
struct _newgen_struct_sequence_ * sequence
#define expression_domain
newgen_execution_domain_defined
#define instruction_sequence_p(x)
#define code_undefined_p(x)
#define forloop_initialization(x)
#define forloop_undefined_p(x)
#define entity_storage(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define code_declarations(x)
#define EXPRESSION(x)
EXPRESSION.
#define cast_expression(x)
#define instruction_undefined
#define statement_label(x)
#define basic_domain
newgen_area_domain_defined
#define expression_undefined
#define sequence_statements(x)
#define expression_undefined_p(x)
#define statement_declarations(x)
#define statement_instruction(x)
#define statement_comments(x)
#define instruction_call(x)
#define statement_undefined_p(x)
#define statement_number(x)
#define instruction_goto_p(x)
#define expression_syntax(x)
#define sequence_domain
newgen_reference_domain_defined
#define statement_undefined
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
#define forloop_undefined
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
The structure used to build lists in NewGen.