PIPS
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "linear.h"
#include "genC.h"
#include "text.h"
#include "text-util.h"
#include "ri.h"
#include "ri-util.h"
#include "workspace-util.h"
#include "prettyprint.h"
#include "effects.h"
#include "misc.h"
#include "properties.h"
Go to the source code of this file.
Data Structures | |
struct | intrinsic_handler |
precedence needed here According to the Precedence of Operators Arithmetic > Character > Relational > Logical Added by Lei ZHOU Nov. More... | |
Functions | |
string | get_comment_sentinel () |
Start a single line comment. More... | |
string | get_comment_continuation () |
Start a single line comment with continuation (blank spaces) More... | |
unsigned int | get_prettyprint_indentation () |
static list | words_cast (cast obj, int precedence, list *ppdl) |
static list | words_sizeofexpression (sizeofexpression obj, bool in_type_declaration, list *ppdl) |
static list | words_subscript (subscript s, list *ppdl) |
static list | words_application (application a, list *ppdl) |
static text | text_forloop (entity module, const char *label, int margin, forloop obj, int n, list *ppdl, bool is_recursive_p) |
static bool | pp_style_p (string s) |
text | empty_text (entity __attribute__((unused)) e, int __attribute__((unused)) m, statement __attribute__((unused)) s) |
void | init_prettyprint (text(*hook)(entity, int, statement)) |
checks that the prettyprint hook was actually reset... More... | |
void | close_prettyprint () |
because some prettyprint functions may be used for debug, so the last hook set by somebody may have stayed there although being non sense... More... | |
bool | one_liner_p (statement s) |
True is statement "s" can be printed out without enclosing braces when it is the true branch of a test. More... | |
bool | gcc_if_block_braces_required_p (test obj) |
static text | insert_locals (text r) |
This function either appends the declaration to the text given as a parameter or return a new text with the declaration. More... | |
static bool | mark_block (unformatted *t_beg, unformatted *t_end, int n, int margin) |
This function returns true if BLOCK boundary markers are required. More... | |
static int | words_intrinsic_precedence (call) |
static int | intrinsic_precedence (const char *) |
list | words_loop_range (range obj, list *ppdl) |
exported for craft More... | |
list | C_loop_range (range obj, entity i, list *ppdl) |
Output a Fortan-like do-loop range as a C-like for-loop index part. More... | |
list | words_range (range obj, list *ppdl) |
list | words_subscript_range (range obj, list *ppdl) |
@description FI: array constructor R433, p. More... | |
list | words_any_reference (reference obj, list *ppdl, const char *(*enf)(entity)) |
exported for expression.c More... | |
list | Words_Any_Reference (reference obj, list pdl, const char *(*enf)(entity)) |
list | words_reference (reference obj, list *ppdl) |
list | Words_Reference (reference obj) |
void | set_alternate_return_set () |
void | reset_alternate_return_set () |
void | add_target_to_alternate_return_set (entity l) |
text | generate_alternate_return_targets () |
list | words_regular_call (call obj, bool is_a_subroutine, list *ppdl) |
words_regular_call used for user subroutine and user function and intrinsics called like user function such as MOD(). More... | |
list | Words_Regular_Call (call obj, bool is_a_subroutine) |
static list | words_genuine_regular_call (call obj, bool is_a_subroutine, list *ppdl) |
To deal with attachment on user module usage. More... | |
list | words_call_intrinsic (call obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list *ppdl) |
static list | words_assign_op (call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl) |
static list | words_substring_op (call obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list *ppdl) |
static list | words_assign_substring_op (call obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list *ppdl) |
static const char * | renamed_op_handling (const char *name) |
static list | words_omp_red (call obj, int precedence __attribute__((unused)), bool leftmost __attribute__((unused)), list *ppdl) |
static list | words_nullary_op_c (call obj, int precedence __attribute__((unused)), bool leftmost __attribute__((unused)), list *ppdl) |
static list | words_nullary_op_fortran (call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl) |
static list | words_nullary_op (call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl) |
static list | words_io_control (list *iol, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list *ppdl) |
static list | words_implied_do (call obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list *ppdl) |
static list | words_unbounded_dimension (call __attribute__((unused)) obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list __attribute__((unused)) *ppdl) |
static list | words_list_directed (call __attribute__((unused)) obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list __attribute__((unused)) *ppdl) |
static list | words_io_inst (call obj, int precedence, bool leftmost, list *ppdl) |
static list | words_stat_io_inst (call obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list *ppdl) |
Implemented for ALLOCATE(), but is applicable for every call to function that take STAT= parameter. More... | |
static list | null (call __attribute__((unused)) obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list __attribute__((unused)) *ppdl) |
static list | words_prefix_unary_op (call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl) |
static list | words_postfix_unary_op (call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl) |
static list | words_unary_minus (call obj, int precedence, bool leftmost, list *ppdl) |
static list | words_inverse_op (call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl) |
WARNING : the floating point division is used wether b is an int or not ! (1.0/b) – in fact b should not be an int ! More... | |
list | words_goto_label (const char *tlabel) |
This function is useful only for parsed codes since gotos are removed by the controlizer. More... | |
static list | eole_fmx_specific_op (call obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, bool isadd, list *ppdl) |
list | eole_fma_specific_op (call obj, int precedence, bool leftmost, list *ppdl) |
EOLE : The multiply-add operator is used within the optimize transformation ( JZ - sept 98) - fma(a,b,c) -> ((a*b)+c) More... | |
list | eole_fms_specific_op (call obj, int precedence, bool leftmost, list *ppdl) |
MULTIPLY-SUB operator. More... | |
static const char * | get_special_prettyprint_for_operator (call obj) |
Check if the given operator is associated with a special prettyprint. More... | |
static list | words_brace_op (call obj, int precedence __attribute__((unused)), bool leftmost __attribute__((unused)), list *ppdl) |
static list | words_infix_nary_op (call obj, int precedence, bool leftmost, list *ppdl) |
Extension of "words_infix_binary_op" function for nary operators used in the EOLE project - (since "nary" assumes operators with at least 2 op) - JZ (Oct. More... | |
static list | words_infix_binary_op (call obj, int precedence, bool leftmost, list *ppdl) |
static list | words_comma_op (call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl) |
Nga Nguyen : this case is added for comma expression in C, but I am not sure about its precedence => to be looked at more carefully. More... | |
static list | words_conditional_op (call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl) |
static void | init_intrinsic_handlers () |
void | register_intrinsic_handler (const char *name, intrinsic_desc_t *desc) |
after this call, name and desc are owned by intrinsic_handlers, but will never be deallocated they must point to permanent storage More... | |
static list | words_intrinsic_call (call obj, int precedence, bool leftmost, list *ppdl) |
static list | words_va_arg (list obj, list *ppdl) |
list | words_call (call obj, int precedence, bool leftmost, bool is_a_subroutine, list *ppdl) |
exported for cmfortran.c More... | |
list | Words_Call (call obj, int precedence, bool leftmost, bool is_a_subroutine) |
list | words_expression (expression obj, list *ppdl) |
This one is exported. More... | |
list | Words_Expression (expression obj) |
of string More... | |
list | words_syntax (syntax obj, list *ppdl) |
exported for expression.c More... | |
list | Words_Syntax (syntax obj) |
list | words_subexpression (expression obj, int precedence, bool leftmost, list *ppdl) |
exported for cmfortran.c More... | |
list | Words_Subexpression (expression obj, int precedence, bool leftmost) |
static sentence | sentence_tail (entity e) |
sentence | sentence_goto_label (entity __attribute__((unused)) module, const char *label, int margin, const char *tlabel, int n) |
exported for unstructured.c More... | |
static sentence | sentence_goto (entity module, const char *label, int margin, statement obj, int n) |
static text | text_block (entity module, const char *label, int margin, list objs, int n, list *ppdl) |
Build the text of a code block (a list of statements) More... | |
static list | loop_private_variables (loop obj, list *ppdl) |
of string More... | |
static string | marged (string prefix, int margin) |
returns a formatted text for the HPF independent and new directive well, no continuations and so, but the directives do not fit the unformatted domain, because the directive prolog would not be well managed there. More... | |
static text | text_directive (loop obj, int margin, string basic_directive, string basic_continuation, string parallel, list *ppdl) |
static text | text_hpf_directive (loop l, int m) |
text | text_omp_directive (loop l, int m) |
text | text_loop_default (entity module, const char *label, int margin, loop obj, int n, list *ppdl, bool is_recursive_p) |
exported for fortran90.c More... | |
text | text_loop (entity module, const char *label, int margin, loop obj, int n, list *ppdl, bool is_recursive_p) |
exported for conversion/look_for_nested_loops.c More... | |
static text | text_whileloop (entity module, const char *label, int margin, whileloop obj, int n, list *ppdl, bool is_recursive_p) |
text | init_text_statement (entity module, int margin, statement obj) |
exported for unstructured.c More... | |
static text | text_logical_if (entity __attribute__((unused)) module, const char *label, int margin, test obj, int n, list *ppdl, bool is_recursive_p) |
static bool | test_with_no_else_clause_p (test t) |
static bool | test_with_dangling_else_p (test t) |
Some code shared by text_block_if and text_block_ifthen. More... | |
static text | text_block_ifthen (entity module, const char *label, int margin, test obj, int n, list *ppdl, bool is_recursive_p) |
Prettyprint if clause of a test. More... | |
static text | text_block_else (entity module, const char *label __attribute__((unused)), int margin, statement stmt, int n __attribute__((unused)), list *ppdl) |
static text | text_block_elseif (entity module, const char *label, int margin, test obj, int n, list *ppdl) |
static text | text_block_if (entity module, const char *label, int margin, test obj, int n, list *ppdl, bool is_recursive_p) |
Prettyprint the condition, the true and, possibly, the false branch. More... | |
static text | text_io_block_if (entity module, const char *label, int margin, test obj, int n, list *ppdl) |
static text | text_test (entity module, const char *label, int margin, test obj, int n, list *ppdl, bool is_recursive_p) |
void | set_prettyprinter_head_hook (string(*f)(entity)) |
void | reset_prettyprinter_head_hook () |
static text | text_instruction (entity module, const char *label, int margin, instruction obj, int n, list *ppdl, bool is_recursive_p) |
bool | C_comment_p (string c) |
In case the input code is not C code, non-standard comments have to be detected. More... | |
text | C_any_comment_to_text (int r_margin, string c) |
In case comments are not formatted according to C rules, e.g. More... | |
text | C_standard_comment_to_text (int margin, string comment) |
text | C_comment_to_text (int margin, string comment) |
Special handling for C comments with each line indented according to the context. More... | |
static list | cstrsplit (const char *s, char delim) |
Split string into a list of strings according to a separator, delim. More... | |
static string | ensure_comment_consistency (const char *i_comments, language l) |
return a formatted comment, that takes care of adding the relevant // or C depending on output language, except for empty lines in C More... | |
Variables | |
char | lib_ri_util_prettyprint_c_rcsid [] = "$Id: misc.c 23181 2016-09-09 12:56:48Z irigoin $" |
misc.c More... | |
static bool | precedence_p = true |
This variable is used to disable the precedence system and hence to prettyprint all parentheses, which let the prettyprint reflect the AST. More... | |
static bool | prettyprint_all_c_braces_p = false |
This variable is used to print braces around all blocks including blocks with only one statement. More... | |
static bool | prettyprint_gcc_c_braces_p = false |
This variable is used to gracefuly print braces around if / else blocks to avoid gcc warnings. More... | |
static text(* | text_statement_hook )(entity, int, statement) = empty_text |
static text | local_var |
static bool | local_flg = false |
static list | set_of_labels_required_for_alternate_returns = list_undefined |
Management of alternate returns. More... | |
static struct intrinsic_handler | tab_intrinsic_handler [] |
static hash_table | intrinsic_handlers = hash_table_undefined |
static string(* | head_hook )(entity) = NULL |
hook for adding something in the head. More... | |
#define CAST_OPERATOR_PRECEDENCE (23) |
#define HPF_CONTINUATION HPF_SENTINEL "x" |
#define HPF_DIRECTIVE HPF_SENTINEL " " |
#define MAXIMAL_PRECEDENCE 100 |
#define OMP_C_CONTINUATION OMP_C_SENTINEL "x" |
#define OMP_C_DIRECTIVE OMP_C_SENTINEL " " |
#define OMP_CONTINUATION OMP_SENTINEL "x" |
#define OMP_DIRECTIVE OMP_SENTINEL " " |
#define pp_cmf_style_p | ( | ) | pp_style_p("cmf") |
#define pp_craft_style_p | ( | ) | pp_style_p("craft") |
#define pp_cray_style_p | ( | ) | pp_style_p("cray") |
#define pp_do_style_p | ( | ) | pp_style_p("do") |
#define pp_doall_style_p | ( | ) | pp_style_p("doall") |
#define pp_f90_style_p | ( | ) | pp_style_p("f90") |
#define pp_hpf_style_p | ( | ) | pp_style_p("hpf") |
#define pp_omp_style_p | ( | ) | pp_style_p("omp") |
#define PRETTYPRINT_UNREACHABLE_EXIT_MARKER "\204Unstructured Unreachable" |
#define PRETTYPRINT_UNSTRUCTURED_BEGIN_MARKER "\200Unstructured" |
#define PRETTYPRINT_UNSTRUCTURED_END_MARKER "\201Unstructured End" |
#define PRETTYPRINT_UNSTRUCTURED_ITEM_MARKER "\202Unstructured Item" |
#define PRETTYPRINT_UNSTRUCTURED_SUCC_MARKER "\203Unstructured Successor ->" |
void add_target_to_alternate_return_set | ( | entity | l | ) |
Definition at line 814 of file misc.c.
References gen_once(), ifdebug, list_undefined_p, pips_assert, and set_of_labels_required_for_alternate_returns.
Referenced by words_regular_call().
In case comments are not formatted according to C rules, e.g.
when prettyprinting Fortran code as C code, add // at beginning of lines
Note: this is supposed to have been dealt with by another function called before, ensure_comment_consistency()
line beginning
line end
current position, pointer in comments
We do not need spaces before a line feed
r_margin | _margin |
Definition at line 4165 of file misc.c.
References ADD_SENTENCE_TO_TEXT, C_comment_p(), CHAIN_SWORD, CONS, cp, free(), gen_strndup0(), is_sentence_unformatted, MAKE_ONE_WORD_SENTENCE, make_sentence(), MAKE_SWORD, make_text(), make_unformatted(), NIL, sentence_undefined, and STRING.
Referenced by C_comment_to_text().
In case the input code is not C code, non-standard comments have to be detected.
Definition at line 4094 of file misc.c.
Referenced by C_any_comment_to_text(), and C_comment_to_text().
Special handling for C comments with each line indented according to the context.
I do not see the interest if the user code is already indented... RK OK, since the blanks outside the comments are removed by the parser.
margin | argin |
comment | omment |
Definition at line 4270 of file misc.c.
References C_any_comment_to_text(), C_comment_p(), comment(), and text_undefined.
Referenced by text_trail().
Output a Fortan-like do-loop range as a C-like for-loop index part.
@description Assume that the increment is an integer so we can generate the good condition. Since the do-loops are recognized in C program part only with this assumptions, it is a good assumption.
call c = syntax_call(expression_syntax(range_increment(obj)));
Complete the initialization assignment
Check the final bound
Increasing or decreasing index?
Assume the increment has an integer value with a known sign If The increment is negative, that means the index is tested against a lower bound Else we assume to test against an upper bound
check if we have something of the form exp -1 as range_upper
Additionally, we want to pretty print a strict comparison if certain conditions are met. This could be the default choice , but the impact on the validation would be huge
Priority for LESS, GREATER, LESS_OR_EQUAL, GREATER_OR_EQUAL: 15
Increment the loop index
obj | bj |
ppdl | pdl |
Definition at line 457 of file misc.c.
References CHAIN_SWORD, copy_expression(), entity_type, entity_user_name(), free_expression(), gen_nconc(), get_referenced_entities(), int_to_expression(), make_op_exp(), negative_expression_p(), pips_user_warning, PLUS_OPERATOR_NAME, positive_expression_p(), range_increment, range_lower, range_upper, SET_FOREACH, set_free(), ultimate_type(), unsigned_type_p(), words_expression(), and words_subexpression().
Referenced by text_loop_default().
position of a line end
Find the first end of line:
No end-of-line, so use all the rest of the comment:
Skip the '
' at the end since the line concept is the notion of sentence
Analyze the next line:
Do not indent if the line is empty
margin | argin |
comment | omment |
Definition at line 4237 of file misc.c.
References ADD_SENTENCE_TO_TEXT, comment(), gen_strndup0(), line, MAKE_ONE_WORD_SENTENCE, make_text(), NIL, and strdup().
void close_prettyprint | ( | void | ) |
because some prettyprint functions may be used for debug, so the last hook set by somebody may have stayed there although being non sense...
Definition at line 242 of file misc.c.
References empty_text(), and text_statement_hook.
Referenced by generic_print_code_pv(), get_any_comp_regions_text(), get_continuation_condition_text(), get_semantic_text(), print_code_or_source_comp(), print_code_points_to(), print_code_static_control(), print_parallelized_code_common(), print_parallelizedCMF_code(), print_parallelizedCRAFT_code(), store_new_module(), text_code_points_to(), text_code_reductions(), and wp65().
|
static |
Split string into a list of strings according to a separator, delim.
Note that the final LF is dropped in C comments
if(delim=='
' && *(e-1)=='
' && *e=='\000')
out=CONS(STRING,strdup(""),out);
Definition at line 4286 of file misc.c.
References CONS, gen_nreverse(), NIL, out, STRING, and strndup().
Referenced by ensure_comment_consistency().
text empty_text | ( | entity __attribute__((unused)) | e, |
int __attribute__((unused)) | m, | ||
statement __attribute__((unused)) | s | ||
) |
Definition at line 219 of file misc.c.
References make_text(), and NIL.
Referenced by close_prettyprint(), init_prettyprint(), init_text_statement(), print_code_or_source(), print_parallelized_code_common(), print_parallelizedCMF_code(), print_parallelizedCRAFT_code(), store_new_module(), and wp65().
return a formatted comment, that takes care of adding the relevant // or C depending on output language, except for empty lines in C
Special handling of comments linked to declarations and to the poor job of the lexical analyzer as regards C comments: failure.
lank line
Build the text of a statement recursively
module | the module containing the statement |
imargin | current tabulation |
stmt | the statement to print |
braces_p | the statement is within a block; this has an impact of the print-out of continue statements in C, ";" |
drop_continue_p | another condition to control the print-out of ";" or not; |
ppdl | pointer to the previous declaration list; list of entities that have already been declared and should not be redeclared; this is required for struct and union which may be declared independently or in a nested way. See C_syntax/struct03, 04, 05, etc... |
Notes:
Handles all statements but tests that are nodes of an unstructured. Those are handled by text_control.
module | the module containing the statement |
margin | current tabulation |
stmt | the statement to print |
ppdl | pointer to the previous declaration list; list of entities that have already been declared and should not be redeclared; this is required for struct and union which may be declared independently or in a nested way. See C_syntax/struct03, 04, 05, etc... |
return a string from a statement, or NULL if undefined
Keep track of the last statement to decide if a final return can be omitted or not. If no last statement can be found for sure, for instance because it depends on the prettyprinter, last_statement_found is set to statement_undefined which is safe.
FI: for purposes unrelated to prettyprint, see last_statement(). This function is part of the prettyprinter and probably only useful for Fortran code.
Hopefully it is a return statement. Since the semantics of STOP is ignored by the parser, a final STOp should be followed by a RETURN.
loop or test cannot be last statements of a module
recursive call
Too many program transformations and syntheses violate the following assert
No warning needed for C, is it right for C ?
I had a lot of trouble writing the condition for this assert...
let's give up: it's always safe
not a block: any kind of statement...
if a block, then a return
adds a RETURN statement to *ps if necessary
Reuse all declarations of the compilation unit, although some may occur after the module definition.
all types and derived entities used to define the formal parameters must be predefined, or they are local to the formal scope and useless.
Build the text of a module.
The original text of the declarations is used if possible in Fortran. Otherwise, the function text_declaration is called.
< the name of the module
Set the prettyprint language
This guard is correct but could be removed if find_last_statement() were robust and/or if the internal representations were always "correct". See also the guard for reset_last_statement()
Add the original header comments if any:
Add the original header comments if any:
C prettyprinter
Print function header if the current module is not a compilation unit
get the declarations for Fortran codes prettyrinted as C, as the declarations are not located in the module statement. A.Mensi
Declarations linked to formal parameters are performed in a different scope and do not have to be propagated.
No need to print TAIL (}) if the current module is a C compilation unit
The node itentifiers are generated from the ordering, more stable than the control node address:
Display the statements of each node followed by the list of its successors if any:
If we have not displayed the exit node, that mean that it is not connex with the entry node and so the code is unreachable. Anyway, it has to be displayed as for the classical Sequential View:
Note that since the controlizer adds a dummy successor to the exit node, use output_a_graph_view_of_the_unstructured_from_a_control() instead of output_a_graph_view_of_the_unstructured_successors():
Even if the code is unreachable, add the fact that the control above is semantically related to the entry node. Add a dash arrow from the entry node to the exit node in daVinci, for example:
================C prettyprinter functions=================
FI: the test used below is probably too strict I believe, because dimensions are not allowed, but I may be wrong
The type must be fully declared: see struct15.c
Parentheses must be added for array expression like __ctype+1 in (__ctype+1)[*np]
Here we differentiate the indices parenthesis syntax
Print now the indices list
Here we differentiate the indices syntax
Parentheses must be added for function expression
To restitute for(;;)
Definition at line 4308 of file misc.c.
References add_control_node_identifier_to_text(), add_one_unformated_printf_to_text(), ADD_SENTENCE_TO_TEXT, application_arguments, application_function, asprintf, attach_head_to_sentence(), basic_derived, c_module_p(), C_STATEMENT_END_STRING, c_text_entities(), c_words_entity(), c_words_simplified_entity(), CAR, cast_expression, CAST_OPERATOR_PRECEDENCE, cast_type, CHAIN_SWORD, code_declarations, code_decls_text, code_language, compilation_unit_p(), CONS, CONTROL, CONTROL_MAP, control_statement, control_successors, cstrsplit(), debug_off, debug_on, derived_type_p(), empty_comments_p(), ENDP, entity_code(), entity_initial, entity_name, entity_type, entity_undefined, entity_undefined_p, entity_user_name(), exp, EXPRESSION, expression_allocatable_data_access_p(), expression_one_p(), expression_undefined_p, f(), find_last_statement(), FOREACH, forloop_body, forloop_condition, forloop_increment, forloop_initialization, fortran_module_p(), fprintf(), free(), free_text(), gen_copy_seq(), gen_free_list(), gen_in_list_p(), gen_last(), gen_nconc(), gen_once(), generate_alternate_return_targets(), generic_text_statement_enclosed(), get_bool_property(), get_declaration_comments(), get_header_comments(), get_prettyprint_indentation(), get_prettyprint_language_tag(), head_hook, ifdebug, INDENTATION, initialize_previously_declared_entities(), instruction_block, instruction_sequence, insure_return_as_last_statement(), is_language_c, is_language_fortran, is_language_fortran95, is_sentence_formatted, is_sentence_unformatted, label_local_name(), language_c_p, language_fortran95_p, language_fortran_p, language_tag, last_statement_p(), lexp, line, lines, make_block_statement(), MAKE_ONE_WORD_SENTENCE, make_return_statement(), make_sentence(), make_text(), make_unformatted(), MAP, MERGE_TEXTS, module, module_entity_to_compilation_unit_entity(), NIL, num, one_liner_p(), ORDERING_NUMBER, ORDERING_STATEMENT, output_a_graph_view_of_the_unstructured(), output_a_graph_view_of_the_unstructured_from_a_control(), output_a_graph_view_of_the_unstructured_successors(), pips_assert, pips_debug, pips_internal_error, pips_user_warning, POP, precedence_p, prefix, prettyprint_all_c_braces_p, prettyprint_gcc_c_braces_p, prettyprint_language_is_fortran_p(), PRETTYPRINT_UNREACHABLE_EXIT_MARKER, PRETTYPRINT_UNSTRUCTURED_BEGIN_MARKER, PRETTYPRINT_UNSTRUCTURED_END_MARKER, PRETTYPRINT_UNSTRUCTURED_ITEM_MARKER, PRETTYPRINT_UNSTRUCTURED_SUCC_MARKER, print_text(), proper_statement_to_string(), reset_alternate_return_set(), reset_label_counter(), reset_last_statement(), ret, return_statement_p(), sentence_head(), sentence_tail(), sequence_statements, set_alternate_return_set(), set_last_statement(), set_prettyprint_language_from_property(), sizeofexpression_expression, sizeofexpression_type, sizeofexpression_type_p, STATEMENT, statement_block_p, statement_call_p(), statement_comments, statement_declarations, statement_identification(), statement_instruction, statement_label, statement_number, statement_ordering, statement_sequence_p(), statement_undefined, statement_undefined_p, statement_unstructured(), statement_unstructured_p(), strdup(), STRING, subscript_array, subscript_indices, text_declaration(), text_forloop(), text_initializations(), text_module(), text_named_module(), Text_Proper_Statement(), Text_Statement(), text_statement(), Text_Statement_Enclosed(), text_statement_enclosed(), text_to_string_nl(), text_undefined, type_supporting_entities(), type_variable, unstructured_control, unstructured_exit, unstructured_to_trail(), value_code, variable_basic, words_application(), words_cast(), words_expression(), words_sizeofexpression(), words_subexpression(), words_subscript(), and words_type().
EOLE : The multiply-add operator is used within the optimize transformation ( JZ - sept 98) - fma(a,b,c) -> ((a*b)+c)
of string
obj | bj |
precedence | recedence |
leftmost | eftmost |
ppdl | pdl |
Definition at line 2049 of file misc.c.
References eole_fmx_specific_op().
MULTIPLY-SUB operator.
of string
obj | bj |
precedence | recedence |
leftmost | eftmost |
ppdl | pdl |
Definition at line 2056 of file misc.c.
References eole_fmx_specific_op().
|
static |
of strings
of expressions
open parenthese one
open parenthese two
get precedence for mult operator
first argument
mult operator
second argument
close parenthese two
get precedence for add operator
add/sub operator
third argument
close parenthese one
Definition at line 1996 of file misc.c.
References call_arguments, CAR, CDR, CHAIN_SWORD, EXPRESSION, gen_nconc(), intrinsic_precedence(), NIL, and words_subexpression().
Referenced by eole_fma_specific_op(), and eole_fms_specific_op().
obj | bj |
Definition at line 336 of file misc.c.
References effective_test_true(), empty_statement_p(), one_liner_p(), prettyprint_gcc_c_braces_p, statement_test(), statement_test_p(), and test_false.
Referenced by text_block_ifthen().
text generate_alternate_return_targets | ( | void | ) |
Definition at line 824 of file misc.c.
References C_CONTINUE_FUNCTION_NAME, CONS, CONTINUE_FUNCTION_NAME, ENDP, FOREACH, gen_nconc(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, is_sentence_unformatted, label_local_name(), make_sentence(), make_text(), make_unformatted(), NIL, pips_internal_error, s1, SENTENCE, sentence_undefined, set_of_labels_required_for_alternate_returns, STATEMENT_NUMBER_UNDEFINED, strdup(), STRING, string_undefined, and text_undefined.
Referenced by ensure_comment_consistency().
string get_comment_continuation | ( | void | ) |
Start a single line comment with continuation (blank spaces)
Definition at line 167 of file misc.c.
References get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, and pips_internal_error.
Referenced by text_pointer_value(), text_pointer_values(), text_points_to_relation(), text_points_to_relations(), text_region_no_action(), and text_transformer().
string get_comment_sentinel | ( | void | ) |
Start a single line comment.
Definition at line 154 of file misc.c.
References get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, and pips_internal_error.
Referenced by init_text_statement(), loop_annotate(), mark_block(), print_any_reductions(), text_complexity(), text_continuation(), text_pointer_value(), text_pointer_values(), text_points_to(), text_points_to_relation(), text_points_to_relations(), text_reductions(), text_region_no_action(), text_transformer(), and text_unstructured().
unsigned int get_prettyprint_indentation | ( | void | ) |
Definition at line 177 of file misc.c.
References INDENTATION, and prettyprint_language_is_fortran_p().
Referenced by ensure_comment_consistency(), sentence_area(), sentence_basic_declaration(), sentence_data(), sentence_data_statement(), sentence_external(), sentence_symbolic(), and text_entity_declaration().
|
static |
Check if the given operator is associated with a special prettyprint.
For instance, n-ary add and multiply operators which are used in the EOLE project use "+" and "*" prettyprints instead of the entity_local_name (JZ - sept 98)
get the entity name
Definition at line 2066 of file misc.c.
References call_function, entity_local_name(), EOLE_PROD_OPERATOR_NAME, and EOLE_SUM_OPERATOR_NAME.
Referenced by words_infix_nary_op().
|
static |
Definition at line 2504 of file misc.c.
References hash_put(), hash_string, hash_table_make(), hash_table_undefined_p, intrinsic_handlers, intrinsic_handler::name, and tab_intrinsic_handler.
Referenced by intrinsic_precedence(), register_intrinsic_handler(), and words_intrinsic_call().
checks that the prettyprint hook was actually reset...
Definition at line 231 of file misc.c.
References empty_text(), pips_assert, and text_statement_hook.
Referenced by generic_print_code_pv(), get_any_comp_regions_text(), get_continuation_condition_text(), get_semantic_text(), print_code_or_source(), print_code_or_source_comp(), print_code_points_to(), print_code_static_control(), print_parallelized_code_common(), print_parallelizedCMF_code(), print_parallelizedCRAFT_code(), store_new_module(), text_code_points_to(), text_code_reductions(), and wp65().
exported for unstructured.c
FI: before calling the hook, statement_ordering(obj) should be checked
module | odule |
margin | argin |
obj | bj |
Definition at line 3462 of file misc.c.
References ADD_SENTENCE_TO_TEXT, asprintf, attach_decoration_to_text(), buffer, empty_text(), get_bool_property(), get_comment_sentinel(), instruction_block_p, instruction_unstructured_p, is_sentence_formatted, make_sentence(), make_text(), module, NIL, ORDERING_NUMBER, ORDERING_STATEMENT, statement_instruction, statement_ordering, STATEMENT_ORDERING_UNDEFINED, and text_statement_hook.
Referenced by text_trail().
This function either appends the declaration to the text given as a parameter or return a new text with the declaration.
Definition at line 363 of file misc.c.
References local_flg, local_var, MERGE_TEXTS, and text_undefined.
Referenced by text_block(), and text_instruction().
|
static |
Definition at line 2539 of file misc.c.
References hash_get(), hash_table_undefined_p, HASH_UNDEFINED_VALUE, init_intrinsic_handlers(), intrinsic_handlers, and intrinsic_desc_t::prec.
Referenced by eole_fmx_specific_op(), words_infix_binary_op(), words_infix_nary_op(), and words_intrinsic_precedence().
of string
obj | the loop to look at. |
stuff around if not empty
This is debugging way to print out code. I do not know which Fortran parser takes this language extension.
In C case, it might be a good idea to re-declare the private variables in the loop body, exceot for outer loop indices, but this is not easy here. PIPS data structures should be updated because loop_private is somehow redundant with statement declarations.
comma-separated list of private variables. built in reverse order to avoid adding at the end...
from now on commas, triggered...
Definition at line 2906 of file misc.c.
References CHAIN_SWORD, CONS, ENTITY, FOREACH, gen_free_list(), gen_length(), gen_nconc(), get_bool_property(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, loop_locals, loop_private_variables_as_entites(), MAKE_SWORD, NIL, pips_debug, pips_internal_error, pips_user_warning, pp_hpf_style_p, pp_omp_style_p, STRING, string_undefined, string_undefined_p, and words_declaration().
Referenced by text_directive(), and text_loop_default().
returns a formatted text for the HPF independent and new directive well, no continuations and so, but the directives do not fit the unformatted domain, because the directive prolog would not be well managed there.
Definition at line 2989 of file misc.c.
References malloc(), prefix, and prettyprint_language_is_fortran_p().
Referenced by text_directive().
|
static |
This function returns true if BLOCK boundary markers are required.
The function also creates the maker when needed.
Definition at line 381 of file misc.c.
References CHAIN_SWORD, get_bool_property(), get_comment_sentinel(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, make_unformatted(), NIL, pips_internal_error, and strdup().
Referenced by text_block().
|
static |
True is statement "s" can be printed out without enclosing braces when it is the true branch of a test.
This is a special case because of dangling else clauses. bool one_liner_true_branch_p(statement s) { bool one_p = false; if(!statement_test_p(s)) one_p = one_liner_p(s); else { test t = instruction_test(statement_instruction(s)); statement f = test_false(t); if(!(empty_statement_p(f) || nop_statement_p(f))) one_p = true; // No need to worry, the else clause exists else { // Make sure there is no internal dangling else... one_p = one_liner_test_p(t); } } return one_p; }
True is test "t" contains a non-empty final "else" clause. bool one_liner_test_p(test t) { bool one_liner_p = false; /* We must make sure that the final else clause is not empty *\/ statement f = test_false(t); if(empty_statement_p(f) || nop_statement_p(f)) one_liner_p = false; else if(statement_test_p(f)) { /* Go down recursively for "else if" constructs. *\/ instruction i = statement_instruction(f); test ft = instruction_test(i); one_liner_p = one_liner_test_p(ft); } else one_liner_p = true; return one_liner_p; }
Can this statement be printed on one line, without enclosing braces, if it is embedded in a loop?
Another test must be used if Statement "s" is embedded in a test a a true branch.
There may be many lines hidden behind another block construct when code is generated in a non canonical way as for {{x=1;y=2;}}
OK, we could check deeper, but this is only useful for redundant internal representations. Let's forget about niceties such as skipping useless braces.
Definition at line 301 of file misc.c.
References CAR, ENDP, gen_length(), instruction_call_p, instruction_expression_p, instruction_forloop_p, instruction_goto_p, instruction_loop_p, instruction_sequence, instruction_sequence_p, instruction_test_p, instruction_whileloop_p, return_instruction_p(), sequence_statements, STATEMENT, statement_declarations, and statement_instruction.
Referenced by ensure_comment_consistency(), gcc_if_block_braces_required_p(), text_block_else(), text_block_elseif(), text_block_ifthen(), text_loop_default(), text_trail(), and text_whileloop().
Definition at line 204 of file misc.c.
References get_string_property(), PRETTYPRINT_PARALLEL, and same_string_p.
void register_intrinsic_handler | ( | const char * | name, |
intrinsic_desc_t * | desc | ||
) |
after this call, name and desc are owned by intrinsic_handlers, but will never be deallocated they must point to permanent storage
name | ame |
desc | esc |
Definition at line 2517 of file misc.c.
References hash_put(), hash_table_undefined_p, init_intrinsic_handlers(), and intrinsic_handlers.
Referenced by step_analyse_init().
|
static |
name,the | pips internal representation of the operator |
Definition at line 1252 of file misc.c.
References AND_OPERATOR_NAME, BITWISE_AND_OPERATOR_NAME, BITWISE_XOR_OPERATOR_NAME, C_AND_OPERATOR_NAME, C_EQUAL_OPERATOR_NAME, C_GREATER_OR_EQUAL_OPERATOR_NAME, C_GREATER_THAN_OPERATOR_NAME, C_LESS_OR_EQUAL_OPERATOR_NAME, C_LESS_THAN_OPERATOR_NAME, C_MODULO_OPERATOR_NAME, C_NON_EQUAL_OPERATOR_NAME, C_OR_OPERATOR_NAME, EQUAL_OPERATOR_NAME, GREATER_OR_EQUAL_OPERATOR_NAME, GREATER_THAN_OPERATOR_NAME, LESS_OR_EQUAL_OPERATOR_NAME, LESS_THAN_OPERATOR_NAME, MINUS_C_OPERATOR_NAME, NON_EQUAL_OPERATOR_NAME, OR_OPERATOR_NAME, PLUS_C_OPERATOR_NAME, and prettyprint_language_is_c_p().
Referenced by words_infix_binary_op(), and words_omp_red().
void reset_alternate_return_set | ( | void | ) |
Definition at line 804 of file misc.c.
References gen_free_list(), ifdebug, list_undefined, list_undefined_p, pips_assert, and set_of_labels_required_for_alternate_returns.
Referenced by ensure_comment_consistency(), fprint_statement(), and statement_to_text().
void reset_prettyprinter_head_hook | ( | void | ) |
Definition at line 3964 of file misc.c.
References head_hook.
Referenced by compile_mpi(), and hpfc_print_code().
|
static |
Definition at line 2797 of file misc.c.
References entity_local_name(), LABEL_PREFIX, module, pips_assert, sentence_goto_label(), and statement_label.
Referenced by text_instruction().
sentence sentence_goto_label | ( | entity __attribute__((unused)) | module, |
const char * | label, | ||
int | margin, | ||
const char * | tlabel, | ||
int | n | ||
) |
exported for unstructured.c
Definition at line 2784 of file misc.c.
References is_sentence_unformatted, make_sentence(), make_unformatted(), strdup(), and words_goto_label().
Referenced by sentence_goto(), text_io_block_if(), and text_trail().
In fortran 95, we want the end to be followed by the type of construct and its name.
Definition at line 2710 of file misc.c.
References CHAIN_SWORD, entity_blockdata_p(), entity_f95module_p(), entity_main_module_p(), entity_type, entity_user_name(), functional_result, get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, is_sentence_unformatted, is_type_unknown, is_type_variable, is_type_void, MAKE_ONE_WORD_SENTENCE, make_sentence(), make_unformatted(), NIL, pips_assert, pips_internal_error, sentence_undefined, static_module_p(), type_functional, type_functional_p, and type_tag.
Referenced by ensure_comment_consistency().
void set_alternate_return_set | ( | void | ) |
Definition at line 795 of file misc.c.
References ifdebug, list_undefined_p, NIL, pips_assert, and set_of_labels_required_for_alternate_returns.
Referenced by ensure_comment_consistency(), fprint_statement(), and statement_to_text().
Definition at line 3963 of file misc.c.
References f(), and head_hook.
Referenced by compile_mpi(), and hpfc_print_code().
Some code shared by text_block_if and text_block_ifthen.
Do we have a test as a true branch, a test with no else clause?
Definition at line 3588 of file misc.c.
References effective_test_true(), nop_statement_p(), statement_test(), statement_test_p(), test_false, and test_with_no_else_clause_p().
Referenced by text_block_ifthen().
Definition at line 3572 of file misc.c.
References empty_statement_p(), statement_test(), statement_test_p(), and test_false.
Referenced by test_with_dangling_else_p().
|
static |
Build the text of a code block (a list of statements)
@module is the module entity the code to display belong to
@label is the label associated to the block
margin | is the indentation level |
objs | is the list of statements in the sequence to display |
n | is the statement number of the sequence |
@pdl is the parser declaration list to track type declaration display in C
"Unformatted" to be added at the beginning and at the end of a block:
Since we generate new { }, we increment the margin for the nested statements:
Now begin block markers and declarations have been printed, so print the block instructions:
Get back to previous indentation:
Definition at line 2826 of file misc.c.
References ADD_SENTENCE_TO_TEXT, CAR, CDR, empty_string_p(), ENDP, free_text(), gen_nconc(), get_bool_property(), INDENTATION, insert_locals(), is_sentence_formatted, is_sentence_unformatted, MAKE_ONE_WORD_SENTENCE, make_sentence(), make_text(), mark_block(), module, NIL, pips_user_warning, STATEMENT, strdup(), text_sentences, and text_statement_enclosed().
Referenced by text_instruction().
|
static |
Definition at line 3664 of file misc.c.
References ADD_SENTENCE_TO_TEXT, continue_statement_p(), empty_statement_p(), fprintf(), get_bool_property(), get_prettyprint_language_tag(), ifdebug, INDENTATION, is_language_c, is_language_fortran, is_language_fortran95, MAKE_ONE_WORD_SENTENCE, make_text(), MERGE_TEXTS, module, NIL, one_liner_p(), pips_internal_error, prettyprint_all_c_braces_p, print_text(), statement_with_empty_comment_p(), text_statement(), and text_statement_enclosed().
Referenced by text_block_elseif(), and text_block_if().
|
static |
Definition at line 3715 of file misc.c.
References ADD_SENTENCE_TO_TEXT, CHAIN_SWORD, empty_comments_p(), entity_empty_label_p(), fprintf(), gen_nconc(), get_prettyprint_language_tag(), ifdebug, INDENTATION, is_language_c, is_language_fortran, is_language_fortran95, is_sentence_unformatted, label_local_name(), MAKE_ONE_WORD_SENTENCE, make_sentence(), make_text(), make_unformatted(), MERGE_TEXTS, module, NIL, one_liner_p(), pips_internal_error, prettyprint_all_c_braces_p, prettyprint_language_is_c_p(), print_text(), statement_comments, statement_label, statement_test(), statement_test_p(), strdup(), test_condition, test_false, test_true, text_block_else(), text_statement_enclosed(), and words_expression().
Referenced by text_block_if().
|
static |
Prettyprint the condition, the true and, possibly, the false branch.
Manage redundant braces in C according to either the standard, or gcc guidelines or a request to print them all.
Brace management is a bit complex because the clausing brace of the true block may be printed with the else branch or as a final brace when the else branch is empty.
Braces are now managed by text_block_ifthen, text_block_elseif or text_block_else to factorize the work and facilitate the engineering. A difference on the output code can be to not put "}" and else in the same line?
Prettyprint the true branch
Prettyprint the false branch if it is useful
one test in the false branch => "ELSEIF" Fortran block or "else if" C construct
Prettyprint the closing of the test
management of braces are take into account inside text_block_ifthen text_block_elseif text_block_else
Definition at line 3795 of file misc.c.
References ADD_SENTENCE_TO_TEXT, empty_comments_p(), entity_empty_label_p(), fprintf(), get_bool_property(), get_prettyprint_language_tag(), ifdebug, is_language_c, is_language_fortran, is_language_fortran95, label_local_name(), MAKE_ONE_WORD_SENTENCE, make_text(), MERGE_TEXTS, module, NIL, pips_internal_error, print_text(), statement_comments, statement_label, statement_test(), statement_test_p(), statement_undefined_p, strdup(), test_false, text_block_else(), text_block_elseif(), and text_block_ifthen().
Referenced by text_test().
|
static |
Prettyprint if clause of a test.
Definition at line 3603 of file misc.c.
References ADD_SENTENCE_TO_TEXT, CHAIN_SWORD, fprintf(), gcc_if_block_braces_required_p(), gen_nconc(), get_prettyprint_language_tag(), ifdebug, INDENTATION, is_language_c, is_language_fortran, is_language_fortran95, is_sentence_unformatted, MAKE_ONE_WORD_SENTENCE, make_sentence(), make_text(), make_unformatted(), MERGE_TEXTS, module, NIL, one_liner_p(), pips_internal_error, prettyprint_all_c_braces_p, prettyprint_language_is_c_p(), print_text(), strdup(), test_condition, test_true, test_with_dangling_else_p(), text_statement_enclosed(), and words_expression().
Referenced by text_block_if().
|
static |
???
of string
start buffer
what about reductions? should be associated to the ri somewhere.
margin | the loop we're interested in |
Definition at line 3005 of file misc.c.
References add_to_current_line(), buffer, close_current_line(), execution_parallel_p, free(), get_bool_property(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, loop_execution, loop_private_variables(), make_text(), MAP, marged(), NIL, pips_internal_error, pp_hpf_style_p, pp_omp_style_p, and STRING.
Referenced by text_hpf_directive(), and text_omp_directive().
|
static |
Referenced by ensure_comment_consistency(), and text_instruction().
Definition at line 3066 of file misc.c.
References HPF_CONTINUATION, HPF_DIRECTIVE, HPF_INDEPENDENT, NIL, and text_directive().
Referenced by text_loop_default().
|
static |
FI: in C at least, this has already been decided by the caller, text_statement_enclosed(); but apparently not in Fortran. Also, the source code may be in Fortran, but the user wants it prettyprinted as C.
Definition at line 3966 of file misc.c.
References C_CONTINUE_FUNCTION_NAME, C_STATEMENT_END_STRING, CHAIN_SWORD, CONS, empty_string_p(), get_bool_property(), get_prettyprint_language_tag(), insert_locals(), instruction_block, instruction_call, instruction_continue_p(), instruction_expression, instruction_forloop, instruction_goto, instruction_loop, instruction_tag, instruction_test, instruction_unstructured, instruction_whileloop, is_instruction_block, is_instruction_call, is_instruction_expression, is_instruction_forloop, is_instruction_goto, is_instruction_loop, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, is_language_c, is_language_fortran, is_language_fortran95, is_sentence_unformatted, make_sentence(), make_text(), make_unformatted(), MERGE_TEXTS, module, NIL, pips_debug, pips_internal_error, prettyprint_language_is_fortran_p(), SENTENCE, sentence_goto(), strdup(), text_block(), text_forloop(), text_loop(), text_test(), text_undefined, text_unstructured(), text_whileloop(), unformatted_undefined, words_call(), and words_expression().
|
static |
Definition at line 3859 of file misc.c.
References ADD_SENTENCE_TO_TEXT, C_CONTINUE_FUNCTION_NAME, CONS, CONTINUE_FUNCTION_NAME, empty_statement_p(), free(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, is_sentence_unformatted, label_local_name(), make_sentence(), make_text(), make_unformatted(), MERGE_TEXTS, module, new_label_local_name(), NIL, pips_internal_error, SENTENCE, sentence_goto_label(), strdup(), STRING, string_undefined, test_false, test_true, and text_statement().
Referenced by text_test().
|
static |
Definition at line 3504 of file misc.c.
References ADD_SENTENCE_TO_TEXT, call_undefined, CHAIN_SWORD, fprintf(), free_text(), gen_nconc(), get_prettyprint_language_tag(), ifdebug, INDENTATION, instruction_call, instruction_undefined, is_language_c, is_language_fortran, is_language_fortran95, is_sentence_unformatted, make_sentence(), make_text(), make_unformatted(), module, NIL, pips_internal_error, print_text(), statement_instruction, strdup(), test_condition, test_true, text_sentences, text_statement(), text_undefined, words_call(), and words_expression().
Referenced by text_test().
text text_loop | ( | entity | module, |
const char * | label, | ||
int | margin, | ||
loop | obj, | ||
int | n, | ||
list * | ppdl, | ||
bool | is_recursive_p | ||
) |
exported for conversion/look_for_nested_loops.c
small hack to show the initial label of the loop to name it...
quite ugly management of other prettyprints...
module | odule |
label | abel |
margin | argin |
obj | bj |
ppdl | pdl |
is_recursive_p | s_recursive_p |
Definition at line 3264 of file misc.c.
References ADD_SENTENCE_TO_TEXT, CAR, concatenate(), entity_empty_label_p(), entity_local_name(), execution_tag, gen_length(), get_bool_property(), instruction_assign_p(), instruction_sequence, instruction_sequence_p, is_execution_parallel, is_execution_sequential, is_sentence_formatted, LABEL_PREFIX, loop_body, loop_execution, loop_label, make_sentence(), make_text(), MERGE_TEXTS, module, NIL, pips_internal_error, pp_cmf_style_p, pp_craft_style_p, pp_f90_style_p, sequence_statements, STATEMENT, statement_instruction, strdup(), text_loop_90(), text_loop_cmf(), text_loop_craft(), text_loop_default(), and text_undefined.
Referenced by print_loops_list(), and text_instruction().
text text_loop_default | ( | entity | module, |
const char * | label, | ||
int | margin, | ||
loop | obj, | ||
int | n, | ||
list * | ppdl, | ||
bool | is_recursive_p | ||
) |
exported for fortran90.c
HPF directives before the loop if required (INDEPENDENT and NEW)
idem if Open MP directives are required
LOOP prologue.
builds the PRIVATE scalar declaration if required
of string
local_var is a global variable which is exploited later...
FI: I do not understand why the local declarations were not added right away. I hope my change (simplification) does not break something else that is not tested by our non-regression suite.
loop BODY
LOOP postlogue
module | odule |
label | abel |
margin | argin |
obj | bj |
ppdl | pdl |
is_recursive_p | s_recursive_p |
Definition at line 3118 of file misc.c.
References ADD_SENTENCE_TO_TEXT, attach_loop_to_sentence_up_to_end_of_text(), C_loop_range(), CHAIN_SWORD, concatenate(), ENDP, entity_empty_label_p(), entity_local_name(), entity_user_name(), execution_sequential_p, gen_nconc(), get_bool_property(), get_prettyprint_language_tag(), INDENTATION, is_language_c, is_language_fortran, is_language_fortran95, is_sentence_unformatted, LABEL_PREFIX, local_flg, local_var, loop_body, loop_execution, loop_index, loop_label, loop_locals, loop_private_variables(), loop_range, MAKE_ONE_WORD_SENTENCE, make_sentence(), make_text(), make_unformatted(), MERGE_TEXTS, module, NIL, one_liner_p(), pips_debug, pips_internal_error, pp_cmf_style_p, pp_craft_style_p, pp_cray_style_p, pp_doall_style_p, pp_hpf_style_p, pp_omp_style_p, prettyprint_all_c_braces_p, sentence_undefined, strdup(), text_hpf_directive(), text_omp_directive(), text_statement_enclosed(), and words_loop_range().
Referenced by text_loop(), and text_loop_90().
Definition at line 3084 of file misc.c.
References get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, NIL, OMP_C_CONTINUATION, OMP_C_DIRECTIVE, OMP_C_PARALLELDO, OMP_CONTINUATION, OMP_DIRECTIVE, OMP_PARALLELDO, pips_internal_error, text_directive(), and text_undefined.
Referenced by text_loop_default().
|
static |
1st case: one statement in the true branch => Fortran logical IF or no braces in C
Definition at line 3913 of file misc.c.
References call_contains_alternate_returns_p(), continue_statement_p(), empty_comments_p(), entity_empty_label_p(), expression_syntax, fprintf(), get_bool_property(), get_prettyprint_language_tag(), ifdebug, io_entity_p(), is_language_c, module, nop_statement_p(), prettyprint_all_c_braces_p, print_text(), reference_variable, statement_call(), statement_call_p(), statement_comments, statement_label, syntax_reference, syntax_reference_p, test_condition, test_false, test_true, text_block_if(), text_io_block_if(), text_logical_if(), and text_undefined.
Referenced by text_instruction().
|
static |
Show the initial label of the loop to name it... FI: I believe this is useless for while loops since they cannot be parallelized.
LOOP prologue.
loop BODY
LOOP postlogue
C do { s; } while (cond); loop
attach_loop_to_sentence_up_to_end_of_text(first_sentence, r, obj);
Definition at line 3341 of file misc.c.
References ADD_SENTENCE_TO_TEXT, CHAIN_SWORD, concatenate(), entity_empty_label_p(), entity_local_name(), eval(), evaluation_before_p, gen_nconc(), get_bool_property(), get_prettyprint_language_tag(), INDENTATION, is_language_c, is_language_fortran, is_language_fortran95, is_sentence_formatted, is_sentence_unformatted, LABEL_PREFIX, MAKE_ONE_WORD_SENTENCE, make_sentence(), make_text(), make_unformatted(), MERGE_TEXTS, module, NIL, one_liner_p(), pips_assert, pips_internal_error, prettyprint_all_c_braces_p, prettyprint_language_is_c_p(), strdup(), text_statement(), text_statement_enclosed(), whileloop_body, whileloop_condition, whileloop_evaluation, whileloop_label, and words_expression().
Referenced by text_instruction().
exported for expression.c
Should only be used to prettyprint proper C references.
We don't want to print these special entity, they are there for internal purpose only
Print the entity first
Let's print the indices now
Definition at line 704 of file misc.c.
References attach_reference_to_word_list(), CAR, CHAIN_SWORD, count, ENTITY_ALLOCATABLE_BOUND_P, EXPRESSION, expression_syntax, FOREACH, gen_last(), gen_nconc(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, NIL, pips_internal_error, reference_indices, reference_variable, STRING, syntax_range, syntax_range_p, words_subexpression(), and words_subscript_range().
Referenced by Words_Any_Reference(), and words_reference().
Definition at line 773 of file misc.c.
References gen_free_list(), and words_any_reference().
Referenced by points_to_words_reference(), and Words_Reference().
|
static |
Referenced by ensure_comment_consistency(), and words_syntax().
|
static |
FI: space_p could be used here to control spacing around assignment
= is not a Fortran operator. No need for parentheses ever, even with the parenthesis option
Brace expressions are not allowed in standard assignments
Be careful with expression lists, they may require surrounding parentheses.
Definition at line 1118 of file misc.c.
References BITWISE_AND_UPDATE_OPERATOR_NAME, BITWISE_XOR_UPDATE_OPERATOR_NAME, brace_expression_p(), call_arguments, call_function, CAR, CDR, CHAIN_SWORD, CONS, ENTITY_ASSIGN_P, entity_local_name(), exp, EXPRESSION, expression_call_p(), expression_syntax, expression_undefined, gen_nconc(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, MAKE_SWORD, MODULO_UPDATE_OPERATOR_NAME, NIL, pips_internal_error, precedence_p, STRING, words_intrinsic_precedence(), words_subexpression(), and words_syntax().
|
static |
The assign substring function call is reduced to a syntactic construct
Definition at line 1227 of file misc.c.
References call_arguments, CAR, CDR, CHAIN_SWORD, EXPRESSION, expression_undefined, gen_length(), gen_nconc(), NIL, pips_assert, words_intrinsic_precedence(), words_subexpression(), and words_substring_op().
|
static |
Definition at line 2091 of file misc.c.
References call_to_expression(), copy_call(), free_expression(), and words_brace_expression().
obj | bj |
precedence | recedence |
leftmost | eftmost |
is_a_subroutine | s_a_subroutine |
Definition at line 2597 of file misc.c.
References gen_free_list(), NIL, and words_call().
Referenced by defs_elim_of_assign_call(), do_simdizer_init(), io_filter(), and text_loop_cmf().
exported for cmfortran.c
obj | bj |
precedence | recedence |
leftmost | eftmost |
is_a_subroutine | s_a_subroutine |
ppdl | pdl |
Definition at line 2575 of file misc.c.
References call_function, entity_initial, f(), MAXIMAL_PRECEDENCE, precedence_p, value_intrinsic_p, words_genuine_regular_call(), and words_intrinsic_call().
Referenced by text_instruction(), text_logical_if(), Words_Call(), words_subexpression(), and words_syntax().
list words_call_intrinsic | ( | call | obj, |
int __attribute__((unused)) | precedence, | ||
bool __attribute__((unused)) | leftmost, | ||
list * | ppdl | ||
) |
Definition at line 1109 of file misc.c.
References words_regular_call().
Referenced by ensure_comment_consistency(), words_subexpression(), and words_syntax().
|
static |
Nga Nguyen : this case is added for comma expression in C, but I am not sure about its precedence => to be looked at more carefully.
Definition at line 2285 of file misc.c.
References call_arguments, CAR, CDR, CHAIN_SWORD, ENDP, EXPRESSION, gen_nconc(), get_bool_property(), NIL, precedence_p, words_intrinsic_precedence(), and words_subexpression().
|
static |
Definition at line 2308 of file misc.c.
References call_arguments, CAR, CDR, CHAIN_SWORD, EXPRESSION, gen_nconc(), NIL, precedence_p, words_intrinsic_precedence(), and words_subexpression().
list Words_Expression | ( | expression | obj | ) |
of string
obj | bj |
Definition at line 2616 of file misc.c.
References expression_syntax, and Words_Syntax().
Referenced by can_terapixify_expression_p(), effect_words_reference(), eval_var(), reference_conversion_expression(), words_cmf_loop_range(), words_loop_list(), words_numerical_dimension(), and words_test_list().
list words_expression | ( | expression | obj, |
list * | ppdl | ||
) |
This one is exported.
Outer parentheses are never useful. ppdl can point to an empty list, but it must be free on return of string
obj | bj |
ppdl | pdl |
Definition at line 2611 of file misc.c.
References expression_syntax, and words_syntax().
Referenced by adg_fprint_list_of_exp(), C_loop_range(), ensure_comment_consistency(), expression_to_string(), fprint_list_of_exp(), generic_c_words_simplified_entity(), imprime_special_quast(), maxima_simplify(), pragma_to_string(), sentence_data_statement(), sentence_symbolic(), text_block_elseif(), text_block_ifthen(), text_entity_declaration(), text_instruction(), text_logical_if(), text_loop_craft(), text_trail(), text_whileloop(), words_brace_expression(), words_dimension(), words_enum(), words_implied_do(), words_io_control(), words_io_inst(), words_loop_range(), words_omp_red(), words_range(), words_stat_io_inst(), words_subscript_range(), words_va_arg(), and words_variable_or_function().
To deal with attachment on user module usage.
The call is not used to code a constant:
The module name is the first one except if it is a procedure CALL.
Definition at line 1090 of file misc.c.
References attach_regular_call_to_word(), call_arguments, call_compatible_type(), call_function, CAR, CDR, entity_type, functional_result, NIL, STRING, type_functional, type_void_p, and words_regular_call().
Referenced by words_call().
list words_goto_label | ( | const char * | tlabel | ) |
This function is useful only for parsed codes since gotos are removed by the controlizer.
of string
<<<<<< .working switch (get_prettyprint_language_tag()) { case is_language_fortran: case is_language_fortran95: pc = CHAIN_SWORD(pc, RETURN_FUNCTION_NAME); break; case is_language_c: pc = CHAIN_SWORD(pc, C_RETURN_FUNCTION_NAME); pc = CHAIN_SWORD(pc, ";"); break; default: pips_internal_error("Language unknown !"); break;
In C, a label cannot begin with a number so "l" is added for this case
In C, a label cannot begin with a number so "l" is added for this case
tlabel | label |
Definition at line 1917 of file misc.c.
References C_CONTINUE_FUNCTION_NAME, C_RETURN_FUNCTION_NAME, CHAIN_SWORD, entity_user_name(), f(), function_to_return_value(), get_current_module_entity(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, NIL, pips_internal_error, RETURN_FUNCTION_NAME, RETURN_LABEL_NAME, strdup(), and void_function_p().
Referenced by sentence_goto_label(), and text_trail().
|
static |
Definition at line 1508 of file misc.c.
References call_arguments, CAR, CDR, CHAIN_SWORD, EXPRESSION, expression_syntax, gen_nconc(), get_bool_property(), MAPL, NIL, pips_internal_error, syntax_range, syntax_range_p, words_expression(), and words_loop_range().
handling of internally renamed operators
Do we want to add a space in case we2 starts with a dereferencing operator "*"? Nga suggests to look at the quake benchmark of SPEC2000.
precedence is greater than * or /
If the operator in the second subexpression has the same priority as the current operator, it has to be parenthesized to respect the structure imposed by the programmer. For instance, a+(b+c) does require parentheses whereas (a+b)+c is the same as a+b+c. So we1 and we2 cannot be processed exactly in the same way.
Use precedence to generate or not parentheses, unless parentheses are always required
Check that C ambiguities such as "a+++b" for "a++ + b" or "a + ++b" are not generated
Definition at line 2176 of file misc.c.
References basic_int_p, basic_of_expression(), call_arguments, call_function, CAR, CDR, CHAIN_SWORD, DIVIDE_OPERATOR_NAME, ENDP, ENTITY_DIVIDE_P, entity_local_name(), exp, EXPRESSION, expression_call_p(), expression_syntax, f(), FIELD_OPERATOR_NAME, free_basic(), gen_last(), gen_nconc(), intrinsic_precedence(), MAXIMAL_PRECEDENCE, MINIMAL_ARITHMETIC_PRECEDENCE, MINUS_OPERATOR_NAME, MULTIPLY_OPERATOR_NAME, NIL, pips_assert, precedence_p, prettyprint_language_is_c_p(), prettyprint_language_is_fortran95_p(), renamed_op_handling(), STRING, syntax_call, words_intrinsic_precedence(), and words_subexpression().
Extension of "words_infix_binary_op" function for nary operators used in the EOLE project - (since "nary" assumes operators with at least 2 op) - JZ (Oct.
98) of string
f string
of expressions
get current operator precedence
open parenthese if necessary
reach the second arg
for all args
divide operator
minus operator
precedence is greater than * or /
operator prettyprint
close parenthese if necessary
Definition at line 2107 of file misc.c.
References call_arguments, call_function, CAR, CDR, CHAIN_SWORD, entity_local_name(), EXPRESSION, expression_call_p(), expression_syntax, gen_nconc(), get_special_prettyprint_for_operator(), intrinsic_precedence(), MAXIMAL_PRECEDENCE, MINIMAL_ARITHMETIC_PRECEDENCE, NIL, syntax_call, words_intrinsic_precedence(), and words_subexpression().
Definition at line 2525 of file misc.c.
References call_function, entity_local_name(), intrinsic_desc_t::f, hash_get(), hash_table_undefined_p, HASH_UNDEFINED_VALUE, init_intrinsic_handlers(), intrinsic_handlers, and words_regular_call().
Referenced by words_call().
Definition at line 2552 of file misc.c.
References call_function, entity_local_name(), and intrinsic_precedence().
Referenced by words_assign_op(), words_assign_substring_op(), words_comma_op(), words_conditional_op(), words_infix_binary_op(), words_infix_nary_op(), words_inverse_op(), words_postfix_unary_op(), words_prefix_unary_op(), words_substring_op(), and words_unary_minus().
|
static |
WARNING : the floating point division is used wether b is an int or not ! (1.0/b) – in fact b should not be an int !
of string
of string
Definition at line 1892 of file misc.c.
References call_arguments, CAR, CHAIN_SWORD, EXPRESSION, gen_nconc(), MAXIMAL_PRECEDENCE, NIL, words_intrinsic_precedence(), and words_subexpression().
|
static |
Definition at line 1467 of file misc.c.
References call_function, CAR, CDR, CHAIN_SWORD, entity_local_name(), EXPRESSION, expression_syntax, gen_nconc(), IO_LIST_STRING_NAME, NIL, pips_internal_error, syntax_call, syntax_call_p, and words_expression().
Referenced by words_io_inst().
AP: I try to convert WRITE to PRINT. Three conditions must be fullfilled. The first, and obvious, one, is that the function has to be WRITE. Secondly, "FMT" has to be equal to "*". Finally, "UNIT" has to be equal either to "*" or "6". In such case, "WRITE(*,*)" is replaced by "PRINT *,".
GO: Not anymore for UNIT=6 leave it ...
Avoid to use words_expression(arg) because it set some attachments and unit_words may not be used later... RK.
The * format is coded as a call to "LIST_DIRECTED_FORMAT_NAME" function:
To display the format later:
Avoid to use words_expression(arg) because it set some attachments and unit_words may not be used later... RK.
The * format is coded as a call to "LIST_DIRECTED_FORMAT_NAME" function:
To display the unit later:
WRITE (*,*) -> PRINT *
WRITE (*,*) pio -> PRINT *, pio
WRITE (*,*) -> PRINT *
READ (*,*) -> READ *
READ (*,*) pio -> READ *, pio
READ (*,*) -> READ *
There is a FORMAT:
FI: missing argument; I use "precedence" because I've no clue; see LZ
because the "IOLIST=" keyword is embedded in the list and because the first IOLIST= has already been skipped, only odd elements are printed
Definition at line 1573 of file misc.c.
References call_arguments, call_function, CAR, CDR, CHAIN_SWORD, ENDP, entity_initial, entity_local_name(), EXPRESSION, expression_syntax, expression_undefined, expression_undefined_p, f(), gen_nconc(), get_bool_property(), get_prettyprint_language_tag(), IO_LIST_STRING_NAME, is_language_c, is_language_fortran, is_language_fortran95, LIST_DIRECTED_FORMAT_NAME, MAPL, NIL, pips_assert, pips_internal_error, POP, prettyprint_language_is_c_p(), same_string_p, syntax_call, syntax_call_p, value_intrinsic_p, words_expression(), and words_io_control().
|
static |
Definition at line 1560 of file misc.c.
References CHAIN_SWORD, and NIL.
exported for craft
expression_constant_p(range_increment(obj)) &&
obj | bj |
ppdl | pdl |
Definition at line 434 of file misc.c.
References call_function, CHAIN_SWORD, entity_local_name(), expression_syntax, gen_nconc(), range_increment, range_lower, range_upper, syntax_call, words_expression(), and words_subexpression().
Referenced by text_loop_craft(), text_loop_default(), and words_implied_do().
|
static |
Definition at line 1445 of file misc.c.
References get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, NIL, pips_internal_error, words_nullary_op_c(), and words_nullary_op_fortran().
|
static |
STOP and PAUSE and RETURN in Fortran may have 0 or 1 argument. STOP and PAUSE are prettyprinted in C using PIPS specific C functions.
Definition at line 1330 of file misc.c.
References basic_int_p, basic_string_p, C_RETURN_FUNCTION_NAME, call_arguments, call_function, CAR, CHAIN_SWORD, CONTINUE_FUNCTION_NAME, entity_local_name(), EXPRESSION, expression_basic(), gen_length(), gen_nconc(), NIL, OMP_FOR_FUNCTION_NAME, OMP_OMP_FUNCTION_NAME, OMP_PARALLEL_FUNCTION_NAME, PAUSE_FUNCTION_NAME, pips_internal_error, pips_user_warning, RETURN_FUNCTION_NAME, same_string_p, STOP_FUNCTION_NAME, and words_subexpression().
Referenced by words_nullary_op().
|
static |
Definition at line 1405 of file misc.c.
References C_RETURN_FUNCTION_NAME, call_arguments, call_function, CAR, CHAIN_SWORD, entity_local_name(), EXPRESSION, gen_length(), gen_nconc(), NIL, OMP_FOR_FUNCTION_NAME, PAUSE_FUNCTION_NAME, pips_internal_error, RETURN_FUNCTION_NAME, same_string_p, STOP_FUNCTION_NAME, and words_subexpression().
Referenced by words_nullary_op().
|
static |
Definition at line 1293 of file misc.c.
References call_arguments, call_function, CHAIN_SWORD, entity_local_name(), entity_user_name(), EXPRESSION, expression_syntax, FOREACH, gen_nconc(), is_syntax_reference, NIL, pips_assert, reference_variable, renamed_op_handling(), syntax_reference, syntax_tag, and words_expression().
|
static |
Definition at line 1831 of file misc.c.
References call_arguments, call_function, CAR, CHAIN_SWORD, CONS, entity_local_name(), EXPRESSION, gen_nconc(), MAKE_SWORD, NIL, POST_DECREMENT_OPERATOR_NAME, POST_INCREMENT_OPERATOR_NAME, precedence_p, STRING, words_intrinsic_precedence(), and words_subexpression().
|
static |
Since we put no spaces around an operator (to not change Fortran), the blank before '*' is used to avoid the confusion in the case of divide operator, i.e d1 = 1.0 / *det in function inv_j, SPEC2000 quake benchmark.
But we do not want this in a lhs and espcially with a double dereferencing.
You do not want to transform +1 + +1 into +1++ 1
Maybe the precedence could be useful to avoid adding a useless SPACE, but unary plus is rare enough to reduce the ROI of such anoptimization to zero.
Definition at line 1781 of file misc.c.
References ADDRESS_OF_OPERATOR_NAME, BITWISE_NOT_OPERATOR_NAME, C_NOT_OPERATOR_NAME, call_arguments, call_function, CAR, CHAIN_SWORD, CONS, DEREFERENCING_OPERATOR_NAME, entity_local_name(), EXPRESSION, gen_nconc(), MAKE_SWORD, NIL, NOT_OPERATOR_NAME, PRE_DECREMENT_OPERATOR_NAME, PRE_INCREMENT_OPERATOR_NAME, precedence_p, prettyprint_language_is_c_p(), STRING, UNARY_PLUS_OPERATOR_NAME, words_intrinsic_precedence(), and words_subexpression().
if undefined I print a star, why not!?
C does not include ranges, but the PIPS internal representation does. For instance, constant ranges can be useful to express effects or regions for intrinsics. To be discussed with Beatrice: e.g. memcpy(), strncp(). Especially when they are called with constant arguments.
obj | bj |
ppdl | pdl |
Definition at line 538 of file misc.c.
References call_function, CHAIN_SWORD, CONS, entity_local_name(), expression_syntax, expression_undefined_p, gen_nconc(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, MAKE_SWORD, NIL, pips_internal_error, range_increment, range_lower, range_upper, STRING, syntax_call, unbounded_expression_p(), and words_expression().
Referenced by make_bounds(), and words_syntax().
obj | bj |
Definition at line 786 of file misc.c.
References entity_user_name(), NIL, and Words_Any_Reference().
Referenced by text_region_no_action(), and words_reduction().
obj | bj |
ppdl | pdl |
Definition at line 781 of file misc.c.
References entity_user_name(), and words_any_reference().
Referenced by adg_fprint_dataflow(), fprint_reference(), reference_to_string(), and words_syntax().
obj | bj |
is_a_subroutine | s_a_subroutine |
Definition at line 1081 of file misc.c.
References gen_free_list(), NIL, and words_regular_call().
Referenced by get_sp_of_call_p().
words_regular_call used for user subroutine and user function and intrinsics called like user function such as MOD().
used also by library static_controlize
special cases for stdarg builtin macros
Special cases for stdio.h
else if (ENTITY__IO_GETC_P(f))
pc = CHAIN_SWORD(pc, "getc");
else if (ENTITY__IO_PUTC_P(f))
pc = CHAIN_SWORD(pc, "putc");
Special cases for Fortran intrinsics not available in C
the implied complex operator is hidden... [D]CMPLX_(x,y) -> (x,y)
The corresponding formal parameter cannot be checked by formal_label_replacement_p() because the called modules may not have been parsed yet.
Alternate return actual argument have been replaced by character strings by the parser.
pips_assert("ls has at least four characters", strlen(ls)>=4);
Get rid of initial and final quotes
free(ls1);
The actual label cannot always be used because it might have been eliminated as part of dead code by PIPS since it is not used with the STOP option.
The assertion may be wrong if this piece of code is used to print intermediate statements
words_expression cannot be called because of the C comma operator which require surrounding parentheses in this context. Be careful with unary minus.
alse
obj | bj |
is_a_subroutine | s_a_subroutine |
ppdl | pdl |
Definition at line 868 of file misc.c.
References actual_label_replacement_p(), add_target_to_alternate_return_set(), asprintf, ASSIGN_OPERATOR_PRECEDENCE, call_arguments, call_compatible_type(), call_function, CAR, CDR, CHAIN_SWORD, ENDP, ENTITY_FALSE_P, ENTITY_IMPLIED_CMPLX_P, ENTITY_IMPLIED_DCMPLX_P, entity_initial, ENTITY_ISOC99_FSCANF_P, ENTITY_ISOC99_SCANF_P, ENTITY_ISOC99_SSCANF_P, ENTITY_ISOC99_VFSCANF_P, ENTITY_ISOC99_VSCANF_P, ENTITY_ISOC99_VSSCANF_P, entity_local_name(), ENTITY_MAX_P, ENTITY_MIN_P, entity_name, ENTITY_TRUE_P, entity_type, entity_undefined_p, entity_user_name(), ENTITY_VA_COPY_P, ENTITY_VA_END_P, ENTITY_VA_START_P, EXPRESSION, expression_call_p(), expression_syntax, f(), find_label_entity(), functional_result, gen_length(), gen_nconc(), get_bool_property(), get_current_module_name(), get_prettyprint_language_tag(), get_string_property(), is_language_c, is_language_fortran, is_language_fortran95, ISOC99_FSCANF_USER_FUNCTION_NAME, ISOC99_SCANF_USER_FUNCTION_NAME, ISOC99_SSCANF_USER_FUNCTION_NAME, ISOC99_VFSCANF_USER_FUNCTION_NAME, ISOC99_VSCANF_USER_FUNCTION_NAME, ISOC99_VSSCANF_USER_FUNCTION_NAME, LABEL_PREFIX, label_string_defined_in_current_module_p(), list_undefined, malloc(), NIL, pips_assert, PIPS_C_MAX_OPERATOR_NAME, PIPS_C_MIN_OPERATOR_NAME, pips_internal_error, pips_user_warning, POP, prettyprint_language_is_c_p(), syntax_call, type_functional, type_statement_p, type_void_p, value_constant_p, value_symbolic_p, and words_subexpression().
Referenced by words_call_intrinsic(), words_genuine_regular_call(), words_intrinsic_call(), and Words_Regular_Call().
|
static |
Referenced by ensure_comment_consistency(), and words_syntax().
|
static |
Implemented for ALLOCATE(), but is applicable for every call to function that take STAT= parameter.
Write call function
STAT= is a call
We got it !
FIXME : strdup ?
get argument
It's not a call
Definition at line 1727 of file misc.c.
References call_arguments, call_function, CAR, CDR, CHAIN_SWORD, entity_local_name(), EXPRESSION, expression_syntax, gen_nconc(), get_bool_property(), NIL, strdup(), syntax_call, syntax_call_p, and words_expression().
list Words_Subexpression | ( | expression | obj, |
int | precedence, | ||
bool | leftmost | ||
) |
obj | bj |
precedence | recedence |
leftmost | eftmost |
Definition at line 2695 of file misc.c.
References gen_free_list(), NIL, and words_subexpression().
Referenced by words_cmf_loop_range().
list words_subexpression | ( | expression | obj, |
int | precedence, | ||
bool | leftmost, | ||
list * | ppdl | ||
) |
exported for cmfortran.c
obj | bj |
precedence | recedence |
leftmost | eftmost |
ppdl | pdl |
Definition at line 2674 of file misc.c.
References expression_call_p(), expression_cast(), expression_cast_p(), expression_syntax, syntax_call, words_call(), words_cast(), and words_syntax().
Referenced by C_loop_range(), ensure_comment_consistency(), eole_fmx_specific_op(), words_any_reference(), words_assign_op(), words_assign_substring_op(), words_comma_op(), words_conditional_op(), words_infix_binary_op(), words_infix_nary_op(), words_inverse_op(), words_loop_range(), words_nullary_op_c(), words_nullary_op_fortran(), words_postfix_unary_op(), words_prefix_unary_op(), words_regular_call(), Words_Subexpression(), words_substring_op(), words_unary_minus(), and words_variable_or_function().
Referenced by ensure_comment_consistency(), and words_syntax().
@description FI: array constructor R433, p.
37 in Fortran 90 standard, can be used anywhere in arithmetic expressions whereas the triplet notation is restricted to subscript expressions. The triplet notation is used to define array sections (see R619, p. 64).
if undefined I print a star, why not!?
obj | bj |
ppdl | pdl |
Definition at line 629 of file misc.c.
References call_function, CHAIN_SWORD, CONS, entity_local_name(), expression_syntax, expression_undefined_p, gen_nconc(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, MAKE_SWORD, NIL, pips_internal_error, range_increment, range_lower, range_upper, STRING, syntax_call, unbounded_expression_p(), and words_expression().
Referenced by words_any_reference().
|
static |
The substring function call is reduced to a syntactic construct
expression e = EXPRESSION(CAR(CDR(CDR(CDR(call_arguments(obj))))));
An unknown upper bound is encoded as a call to UNBOUNDED_DIMENSION_NAME and nothing must be printed
Definition at line 1187 of file misc.c.
References call_arguments, call_function, CAR, CDR, CHAIN_SWORD, CreateIntrinsic(), EXPRESSION, expression_syntax, expression_undefined, gen_length(), gen_nconc(), NIL, pips_assert, syntax_call, syntax_call_p, UNBOUNDED_DIMENSION_NAME, words_intrinsic_precedence(), and words_subexpression().
Referenced by words_assign_substring_op().
obj | bj |
Definition at line 2664 of file misc.c.
References gen_free_list(), NIL, and words_syntax().
Referenced by comp_regions_of_syntax(), Words_Expression(), and xml_Argument().
exported for expression.c
FI->SG: I do not know if in_type_declaration is true, false or a formal parameter
obj | bj |
ppdl | pdl |
Definition at line 2623 of file misc.c.
References is_syntax_application, is_syntax_call, is_syntax_cast, is_syntax_range, is_syntax_reference, is_syntax_sizeofexpression, is_syntax_subscript, is_syntax_va_arg, NIL, pips_internal_error, syntax_application, syntax_call, syntax_cast, syntax_range, syntax_reference, syntax_sizeofexpression, syntax_subscript, syntax_tag, syntax_va_arg, words_application(), words_call(), words_cast(), words_range(), words_reference(), words_sizeofexpression(), words_subscript(), and words_va_arg().
Referenced by fprint_expression(), print_syntax(), words_assign_op(), words_expression(), words_subexpression(), and Words_Syntax().
make sure the minus can not be split apart from its argument
Definition at line 1860 of file misc.c.
References asprintf, call_arguments, CAR, CHAIN_SWORD, CONS, EXPRESSION, free(), gen_nconc(), NIL, POP, precedence_p, STRING, words_intrinsic_precedence(), and words_subexpression().
|
static |
Definition at line 1547 of file misc.c.
References CHAIN_SWORD, and NIL.
Definition at line 2558 of file misc.c.
References CAR, CDR, CHAIN_SWORD, gen_nconc(), get_bool_property(), NIL, SIZEOFEXPRESSION, sizeofexpression_expression, sizeofexpression_type, words_expression(), and words_type().
Referenced by words_syntax().
hook for adding something in the head.
used by hpfc. done so to avoid hpfc->prettyprint dependence in the libs. FC. 29/12/95.
Definition at line 3962 of file misc.c.
Referenced by ensure_comment_consistency(), reset_prettyprinter_head_hook(), and set_prettyprinter_head_hook().
|
static |
Definition at line 2502 of file misc.c.
Referenced by init_intrinsic_handlers(), intrinsic_precedence(), register_intrinsic_handler(), and words_intrinsic_call().
char lib_ri_util_prettyprint_c_rcsid[] = "$Id: misc.c 23181 2016-09-09 12:56:48Z irigoin $" |
Definition at line 357 of file misc.c.
Referenced by insert_locals(), and text_loop_default().
|
static |
Definition at line 356 of file misc.c.
Referenced by insert_locals(), and text_loop_default().
This variable is used to disable the precedence system and hence to prettyprint all parentheses, which let the prettyprint reflect the AST.
Definition at line 194 of file misc.c.
Referenced by ensure_comment_consistency(), words_assign_op(), words_call(), words_comma_op(), words_conditional_op(), words_infix_binary_op(), words_postfix_unary_op(), words_prefix_unary_op(), and words_unary_minus().
This variable is used to print braces around all blocks including blocks with only one statement.
Definition at line 197 of file misc.c.
Referenced by ensure_comment_consistency(), text_block_else(), text_block_elseif(), text_block_ifthen(), text_loop_default(), text_test(), and text_whileloop().
This variable is used to gracefuly print braces around if / else blocks to avoid gcc warnings.
Definition at line 200 of file misc.c.
Referenced by ensure_comment_consistency(), and gcc_if_block_braces_required_p().
|
static |
Management of alternate returns.
Definition at line 793 of file misc.c.
Referenced by add_target_to_alternate_return_set(), generate_alternate_return_targets(), reset_alternate_return_set(), and set_alternate_return_set().
|
static |
Referenced by init_intrinsic_handlers().
|
static |
Definition at line 225 of file misc.c.
Referenced by close_prettyprint(), init_prettyprint(), and init_text_statement().