PIPS
|
#include <stdio.h>
#include <ctype.h>
#include "genC.h"
#include "linear.h"
#include "properties.h"
#include "misc.h"
#include "pipsdbm.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "text-util.h"
Go to the source code of this file.
Data Structures | |
struct | s_ppt |
struct | c_full_name |
Macros | |
#define | EMPTY "" |
#define | NL "\n" |
#define | SEMICOLON ";" NL |
#define | SPACE " " |
#define | OPENBRACKET "[" |
#define | CLOSEBRACKET "]" |
#define | OPENPAREN "(" |
#define | CLOSEPAREN ")" |
#define | OPENBRACE "{" |
#define | CLOSEBRACE "}" |
#define | SHARPDEF "#define" |
#define | COMMENT "//" SPACE |
#define | INDENT "indent" |
#define | CROUGH ".crough" |
#define | CPRETTY ".c" |
#define | INTERFACE "_interface.f08" |
#define | SCALAR_IN_SIG_EXT "_p4a_copy" |
#define | MAX_FCT "crough_max" |
#define | MIN_FCT "crough_min" |
#define | MAX_DEF "#define " MAX_FCT "(a,b) (((a)>(b))?(a):(b))\n" |
#define | MIN_DEF "#define " MIN_FCT "(a,b) (((a)<(b))?(a):(b))\n" |
#define | POW_PRE "crough_" |
#define | POW_DEF "#define " POW_PRE "powi(a,b) ((a)^(b))\n" |
#define | CMPLX_FCT "init_complex" |
#define | CMPLX_DEF "#define " CMPLX_FCT "(a,b) (a + b*I)\n" |
#define | current_module_is_a_function() (entity_function_p(get_current_module_entity())) |
#define | RESULT_NAME "result" |
#define | MAIN_DECLARATION "int main(int argc, char *argv[])" NL |
returns the head of the function/subroutine/program. More... | |
#define | RET "return" |
#define | CONT "continue" |
Typedefs | |
typedef string(* | prettyprinter) (const char *, list) |
generate a basic c expression. More... | |
Functions | |
static string | c_expression (expression, bool) |
forward declaration. More... | |
static bool | convert_double_value (char **str) |
test if the string looks like a REAL*8 (double in C) declaration i.e something like 987987D54654 : a bunch of digit with a letter in the middle. More... | |
static void | const_wrapper (char **s) |
static char * | c_entity_local_name (entity var) |
static void | build_written_list (list l) |
static bool | written_p (entity e) |
static string | scalar_prelude () |
static string | scalar_postlude () |
static bool | scalar_by_pointer (entity var) |
we want to decide if a scalar variable need to be passed by pointer or by value to a C function. More... | |
static string | c_basic_string (basic b) |
static string | c_type_string (type t) |
static string | c_dim_string (list ldim, bool fct_sig) |
static string | c_qualifier_string (list l) |
static string | c_brace_expression_string (expression exp) |
static string | this_entity_cdeclaration (entity var, bool fct_sig) |
static bool | parameter_p (entity e) |
static bool | variable_p (entity e) |
static bool | parameter_or_variable_p (entity e) |
static bool | argument_p (entity e) |
static string | c_declarations (entity module, bool(*consider_this_entity)(entity), string separator, bool lastsep, bool fct_sig) |
static string | c_include (void) |
static string | c_macro (void) |
static string | c_head (entity module) |
static bool | expression_needs_parenthesis_p (expression) |
static string | ppt_binary (const char *in_c, list le) |
static string | ppt_unary (const char *in_c, list le) |
static string | ppt_unary_post (const char *in_c, list le) |
static string | ppt_call (const char *in_c, list le) |
SG: PBM spotted HERE. More... | |
static void | get_c_full_name (string *base_in_c, basic b) |
fill the c_base_name to get the c full name accorgind to its basic More... | |
static string | ppt_math (const char *in_c, list le) |
static string | ppt_min_max (const char *in_c, list le) |
static string | ppt_unknown (const char *in_f, list le) |
static string | ppt_must_error (const char *in_f, _UNUSED_ list le) |
static struct s_ppt * | get_ppt (entity f) |
return the prettyprinter structure for c. More... | |
static string | c_call (call c, bool breakable) |
static string | c_reference (reference r) |
Attention with Fortran: the indexes are reversed. More... | |
static string | c_statement (statement s, bool breakable) |
static string | c_unstructured (unstructured u, bool breakable) |
static string | c_test (test t, bool breakable) |
static string | c_sequence (sequence seq, bool breakable) |
static string | c_loop (loop l) |
static string | c_whileloop (whileloop w) |
static string | c_forloop (forloop f) |
static string | interface_type_string (type t, bool value) |
static string | interface_basic_string (basic b, bool value) |
Convert the fortran basic to its interface string value. More... | |
static string | interface_argument_type_string (entity var) |
return a string representation of the type to be used for a variable decalaration in an interface module in order to ensure that the C function can be called from fotran codes More... | |
static string | interface_argument_declaration (entity module, string separator, string indent) |
static string | interface_signature (entity module) |
return the interface signature for a module, i.e. More... | |
static string | interface_code_string (entity module, _UNUSED_ statement stat) |
static string | c_code_string (entity module, statement stat) |
bool | print_interface (const char *module_name) |
cprettyprinter.c More... | |
bool | print_crough (const char *module_name) |
bool | print_c_code (const char *module_name) |
C indentation thru indent. More... | |
Variables | |
static list | l_type = NIL |
static list | l_name = NIL |
static list | l_rename = NIL |
static list | l_entity = NIL |
static list | l_written = NIL |
static c_full_name | c_base_name_to_c_full_name [] |
static struct s_ppt | intrinsic_to_c [] |
#define CLOSEBRACE "}" |
Definition at line 74 of file cprettyprinter.c.
#define CLOSEBRACKET "]" |
Definition at line 68 of file cprettyprinter.c.
#define CLOSEPAREN ")" |
Definition at line 71 of file cprettyprinter.c.
#define CMPLX_DEF "#define " CMPLX_FCT "(a,b) (a + b*I)\n" |
Definition at line 96 of file cprettyprinter.c.
#define CMPLX_FCT "init_complex" |
Definition at line 95 of file cprettyprinter.c.
#define COMMENT "//" SPACE |
Definition at line 77 of file cprettyprinter.c.
#define CONT "continue" |
Definition at line 1399 of file cprettyprinter.c.
#define CPRETTY ".c" |
Definition at line 82 of file cprettyprinter.c.
#define CROUGH ".crough" |
Definition at line 81 of file cprettyprinter.c.
#define current_module_is_a_function | ( | ) | (entity_function_p(get_current_module_entity())) |
Definition at line 112 of file cprettyprinter.c.
#define EMPTY "" |
Definition at line 62 of file cprettyprinter.c.
#define INDENT "indent" |
Definition at line 80 of file cprettyprinter.c.
#define INTERFACE "_interface.f08" |
Definition at line 83 of file cprettyprinter.c.
returns the head of the function/subroutine/program.
declarations look ANSI C.
Definition at line 903 of file cprettyprinter.c.
#define MAX_DEF "#define " MAX_FCT "(a,b) (((a)>(b))?(a):(b))\n" |
Definition at line 91 of file cprettyprinter.c.
#define MAX_FCT "crough_max" |
Definition at line 89 of file cprettyprinter.c.
#define MIN_DEF "#define " MIN_FCT "(a,b) (((a)<(b))?(a):(b))\n" |
Definition at line 92 of file cprettyprinter.c.
#define MIN_FCT "crough_min" |
Definition at line 90 of file cprettyprinter.c.
#define NL "\n" |
Definition at line 63 of file cprettyprinter.c.
#define OPENBRACE "{" |
Definition at line 73 of file cprettyprinter.c.
#define OPENBRACKET "[" |
Definition at line 67 of file cprettyprinter.c.
#define OPENPAREN "(" |
Definition at line 70 of file cprettyprinter.c.
#define POW_DEF "#define " POW_PRE "powi(a,b) ((a)^(b))\n" |
Definition at line 94 of file cprettyprinter.c.
#define POW_PRE "crough_" |
Definition at line 93 of file cprettyprinter.c.
#define RESULT_NAME "result" |
Definition at line 116 of file cprettyprinter.c.
#define RET "return" |
Definition at line 1398 of file cprettyprinter.c.
#define SCALAR_IN_SIG_EXT "_p4a_copy" |
Definition at line 86 of file cprettyprinter.c.
#define SEMICOLON ";" NL |
Definition at line 64 of file cprettyprinter.c.
#define SHARPDEF "#define" |
Definition at line 76 of file cprettyprinter.c.
#define SPACE " " |
Definition at line 65 of file cprettyprinter.c.
generate a basic c expression.
no operator priority is assumed...
Definition at line 967 of file cprettyprinter.c.
Formal variables
Definition at line 792 of file cprettyprinter.c.
References entity_storage, entity_type, storage_formal_p, and type_variable_p.
Referenced by c_head(), interface_argument_declaration(), interface_argument_type_string(), and interface_signature().
|
static |
Definition at line 211 of file cprettyprinter.c.
References EFFECT, effect_any_entity, effect_write_p, entity_local_name(), FOREACH, gen_entity_cons(), l_written, and pips_debug.
Referenced by print_crough().
An expression indeed... To be fixed...
ignore if it is signed or unsigned
c99 style with include of complex.h
Definition at line 345 of file cprettyprinter.c.
References basic_bit, basic_derived, basic_float, basic_int, basic_pointer, basic_tag, basic_typedef, c_entity_local_name(), c_type_string(), concatenate(), entity_type, free(), get_bool_property(), get_string_property(), is_basic_bit, is_basic_complex, is_basic_derived, is_basic_float, is_basic_int, is_basic_logical, is_basic_pointer, is_basic_string, is_basic_typedef, pips_debug, pips_internal_error, SPACE, and strdup().
Referenced by c_head(), c_type_string(), and this_entity_cdeclaration().
|
static |
Definition at line 556 of file cprettyprinter.c.
References brace_expression_p(), call_arguments, concatenate(), exp, EXPRESSION, expression_syntax, expression_to_string(), FOREACH, strdup(), and syntax_call.
Referenced by this_entity_cdeclaration().
special case...
Definition at line 1401 of file cprettyprinter.c.
References s_ppt::c, call_arguments, call_constant_p, call_function, concatenate(), const_wrapper(), CONT, current_module_is_a_function, entity_local_name(), entity_main_module_p(), free(), get_current_module_entity(), get_ppt(), local_name(), s_ppt::ppt, RESULT_NAME, RET, same_string_p, scalar_postlude(), SPACE, strdup(), and strlower().
Referenced by c_expression(), and c_statement().
What about declarations that are external a module scope ? Consider a source file as a module entity, put all declarations in it (external static + TOP-LEVEL)
before_head only generates the constant declarations, such as #define
Definition at line 2108 of file cprettyprinter.c.
References c_declarations(), c_head(), c_include(), c_macro(), c_statement(), CLOSEBRACE, concatenate(), free(), ifdebug, include(), module, NL, OPENBRACE, parameter_or_variable_p(), print_entities(), print_statement(), printf(), scalar_prelude(), SEMICOLON, statement_declarations, and strdup().
Referenced by print_crough().
|
static |
module,the | module to get the declaration. |
consider_this_entity,the | function test pointer. |
separator,the | separatot to be used between vars. |
lastsep,set | to true if a final separator is needed. |
fct_sig,set | to true if in a function signature. |
Definition at line 805 of file cprettyprinter.c.
References c_entity_local_name(), code_declarations, concatenate(), ENTITY, entity_initial, FOREACH, free(), module, pips_assert, pips_debug, strdup(), this_entity_cdeclaration(), value_code, and value_code_p.
Referenced by c_code_string(), and c_head().
ldim | the variable dimension |
fct_sig,set | to true if the variable is part of a function signature |
In fact, the lower bound of array in C is always equal to 0, we only need to print (upper dimension + 1) but in order to handle Fortran code, we check all other possibilities and print (upper - lower + 1). Problem : the order of dimensions is reversed !!!!
to be refined here to make more beautiful expression
otherwise the list is empty, no dimension to declare
Definition at line 452 of file cprettyprinter.c.
References c_expression(), CLOSEBRACKET, concatenate(), CreateIntrinsic(), DIMENSION, dimension_lower, dimension_upper, expression_integer_value(), expression_to_string(), FOREACH, free(), get_bool_property(), int2a(), int_to_expression(), intptr_t, MakeBinaryCall(), NIL, OPENBRACKET, SCALAR_IN_SIG_EXT, strdup(), and strlower().
Referenced by this_entity_cdeclaration().
|
static |
Delete all the prefixes
switch to lower cases...
Definition at line 176 of file cprettyprinter.c.
References current_module_is_a_function, entity_local_name(), ENUM_PREFIX, get_current_module_entity(), MEMBER_SEP_STRING, pips_debug, RESULT_NAME, same_string_p, strdup(), strlower(), STRUCT_PREFIX, TYPEDEF_PREFIX, and UNION_PREFIX.
Referenced by c_basic_string(), c_declarations(), c_head(), c_loop(), c_reference(), c_statement(), interface_argument_declaration(), interface_code_string(), interface_signature(), and this_entity_cdeclaration().
|
static |
forward declaration.
add cast, sizeof here
Definition at line 1486 of file cprettyprinter.c.
References c_call(), c_reference(), expression_syntax, is_syntax_call, is_syntax_range, is_syntax_reference, pips_internal_error, strdup(), syntax_call, syntax_reference, and syntax_tag.
Referenced by c_dim_string(), c_forloop(), c_loop(), c_reference(), c_test(), c_unstructured(), c_whileloop(), ppt_binary(), ppt_call(), ppt_min_max(), ppt_unary(), and ppt_unary_post().
partial implementation...
Definition at line 1762 of file cprettyprinter.c.
References c_expression(), c_statement(), concatenate(), f(), forloop_body, forloop_condition, forloop_increment, forloop_initialization, free(), init, NL, and strdup().
Referenced by c_statement().
another kind : "int main(void)" ?
define type head.
define args.
Definition at line 905 of file cprettyprinter.c.
References argument_p(), c_basic_string(), c_declarations(), c_entity_local_name(), CLOSEPAREN, concatenate(), entity_main_module_p(), entity_subroutine_p(), entity_type, f(), free(), functional_parameters, functional_result, get_bool_property(), get_string_property(), MAIN_DECLARATION, module, NL, OPENPAREN, pips_assert, SPACE, strdup(), type_functional, type_functional_p, type_variable, type_variable_p, and variable_basic.
Referenced by c_code_string().
|
static |
Definition at line 846 of file cprettyprinter.c.
References concatenate(), free(), get_bool_property(), get_string_property(), pips_debug, and strdup().
Referenced by c_code_string().
partial implementation... However, there is not this kind of loop in C
what about step
Definition at line 1711 of file cprettyprinter.c.
References c_entity_local_name(), c_expression(), c_statement(), CLOSEBRACE, concatenate(), free(), loop_body, loop_index, loop_range, NL, OPENBRACE, range_increment, range_lower, range_upper, SPACE, and strdup().
Referenced by c_statement(), and loop_annotate().
|
static |
Definition at line 888 of file cprettyprinter.c.
References CMPLX_DEF, concatenate(), MAX_DEF, MIN_DEF, POW_DEF, and strdup().
Referenced by c_code_string().
Definition at line 519 of file cprettyprinter.c.
References concatenate(), FOREACH, is_qualifier_asm, is_qualifier_auto, is_qualifier_const, is_qualifier_register, is_qualifier_restrict, is_qualifier_static_dimension, is_qualifier_thread, is_qualifier_volatile, pips_internal_error, QUALIFIER, qualifier_asm, qualifier_tag, and strdup().
Referenced by this_entity_cdeclaration().
Attention with Fortran: the indexes are reversed.
And array dimensions in C always rank from 0. BC.
Definition at line 1444 of file cprettyprinter.c.
References c_entity_local_name(), c_expression(), CAR, CLOSEBRACKET, concatenate(), copy_expression(), DIMENSION, dimension_lower, EMPTY, entity_intrinsic(), entity_type, EXPRESSION, expression_equal_integer_p(), expression_integer_value(), FOREACH, free(), free_expression(), int2a(), intptr_t, MakeBinaryCall(), MINUS_OPERATOR_NAME, OPENBRACKET, POP, reference_indices, reference_variable, strdup(), type_variable, ultimate_type(), and variable_dimensions.
Referenced by c_expression().
Definition at line 1697 of file cprettyprinter.c.
References c_statement(), concatenate(), current, EMPTY, FOREACH, free(), sequence_statements, STATEMENT, and strdup().
Referenced by c_statement().
rintf("\nCurrent statement : \n"); print_statement(s);
add switch, forloop break, continue, return instructions here
Definition at line 1781 of file cprettyprinter.c.
References c_call(), c_entity_local_name(), c_forloop(), c_loop(), c_sequence(), c_test(), c_unstructured(), c_whileloop(), COMMENT, concatenate(), debug(), ENDP, ENTITY, entity_local_name(), f(), free(), instruction_call, instruction_forloop, instruction_goto, instruction_loop, instruction_sequence, instruction_tag, instruction_test, instruction_unstructured, instruction_whileloop, is_instruction_call, is_instruction_forloop, is_instruction_goto, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, LABEL_PREFIX, MAP, NL, SEMICOLON, statement_declarations, statement_instruction, statement_label, strdup(), and this_entity_cdeclaration().
Referenced by c_code_string(), c_forloop(), c_loop(), c_sequence(), c_test(), c_unstructured(), and c_whileloop().
Definition at line 1676 of file cprettyprinter.c.
References c_expression(), c_statement(), concatenate(), empty_statement_p(), free(), NL, strdup(), test_condition, test_false, and test_true.
Referenced by c_statement(), controlize_forloop(), controlize_loop(), controlize_repeatloop(), controlize_whileloop(), and link_3_control_nodes().
Definition at line 307 of file cprettyprinter.c.
References c_basic_string(), is_type_enum, is_type_struct, is_type_union, is_type_variable, is_type_void, pips_user_warning, SPACE, strdup(), type_tag, type_variable, and variable_basic.
Referenced by c_basic_string(), and this_entity_cdeclaration().
|
static |
build an arbitrary reverse trail of control nodes
Copy from text_trail ...
A GOTO must be generated to reach the control successor
Is there a textual successor?
This may happen after restructuring
succ2 must be reached by GOTO
succ1 must be reached by GOTO
Both successors must be labelled
Both successors must be textual predecessors
Definition at line 1510 of file cprettyprinter.c.
References s_ppt::c, c_expression(), c_statement(), CAR, CDR, check_io_statement_p(), concatenate(), CONTROL, control_statement, control_successors, dump_trail(), ENDP, gen_free_list(), gen_length(), gen_nreverse(), get_bool_property(), ifdebug, instruction_test, instruction_test_p, label_local_name(), NIL, NL, pips_assert, pips_internal_error, POP, print_statement(), printf(), SEMICOLON, statement_does_return(), statement_instruction, statement_label, strdup(), string_undefined, test_condition, and unstructured_to_trail().
Referenced by c_statement().
partial implementation...
o while and while do loops
Definition at line 1743 of file cprettyprinter.c.
References c_expression(), c_statement(), concatenate(), eval(), evaluation_before_p, free(), NL, strdup(), whileloop_body, whileloop_condition, and whileloop_evaluation.
Referenced by c_statement().
|
static |
search fortran constant
Definition at line 149 of file cprettyprinter.c.
References convert_double_value(), free(), pips_debug, strdup(), and strlower().
Referenced by c_call().
|
static |
test if the string looks like a REAL*8 (double in C) declaration i.e something like 987987D54654 : a bunch of digit with a letter in the middle.
if yes convert it to C (i.e replace D by E) and return true
Definition at line 123 of file cprettyprinter.c.
References pips_debug, and strdup().
Referenced by const_wrapper().
|
static |
Definition at line 1381 of file cprettyprinter.c.
References call_function, expression_syntax, get_ppt(), is_syntax_call, is_syntax_range, is_syntax_reference, s_ppt::ppt, ppt_binary(), syntax_call, and syntax_tag.
Referenced by ppt_binary().
fill the c_base_name to get the c full name accorgind to its basic
Definition at line 1095 of file cprettyprinter.c.
References basic_tag, basic_type_size(), basic_undefined, c_full_name::c_base_name, c_base_name_to_c_full_name, intptr_t, pips_assert, pips_debug, pips_internal_error, c_full_name::prefix, same_string_p, c_full_name::size, str_append(), str_prepend(), c_full_name::suffix, and c_full_name::type.
Referenced by ppt_math().
return the prettyprinter structure for c.
Definition at line 1372 of file cprettyprinter.c.
References entity_local_name(), f(), s_ppt::intrinsic, intrinsic_to_c, and same_string_p.
Referenced by c_call(), and expression_needs_parenthesis_p().
|
static |
module,the | module to get the declaration. |
separator,the | separatot to be used between vars. |
lastsep,set | to true if a final separator is needed. |
Definition at line 2021 of file cprettyprinter.c.
References argument_p(), s_ppt::c, c_entity_local_name(), code_declarations, concatenate(), ENTITY, entity_initial, FOREACH, free(), interface_argument_type_string(), module, pips_assert, strdup(), value_code, and value_code_p.
Referenced by interface_code_string().
return a string representation of the type to be used for a variable decalaration in an interface module in order to ensure that the C function can be called from fotran codes
Definition at line 2003 of file cprettyprinter.c.
References argument_p(), entity_type, interface_type_string(), pips_assert, strdup(), type_variable, and variable_dimensions.
Referenced by interface_argument_declaration().
Convert the fortran basic to its interface string value.
b,the | basic to be converted to string |
value,set | to true if the var has to be passed by value |
case 1: result = "char";
break;
case 2: result = "short";
break;
case 6: result = "long";
break;
case 11: result = "unsigned char";
break;
case 12: result = "unsigned short";
break;
case 14: result = "unsigned int";
break;
case 16: result = "unsigned long";
break;
case 18: result = "unsigned long long";
break;
case 21: result = "signed char";
break;
case 22: result = "signed short";
break;
case 24: result = "signed int";
break;
case 26: result = "signed long";
break;
case 28: result = "signed long long";
break;
Definition at line 1871 of file cprettyprinter.c.
References basic_float, basic_int, basic_pointer, basic_tag, concatenate(), free(), get_bool_property(), get_string_property(), interface_type_string(), is_basic_bit, is_basic_derived, is_basic_float, is_basic_int, is_basic_logical, is_basic_pointer, is_basic_string, is_basic_typedef, pips_assert, pips_debug, pips_internal_error, SPACE, strdup(), and type_void_p.
Referenced by interface_type_string().
Definition at line 2078 of file cprettyprinter.c.
References c_entity_local_name(), concatenate(), entity_subroutine_p(), free(), interface_argument_declaration(), interface_signature(), module, pips_assert, and strdup().
Referenced by print_interface().
return the interface signature for a module, i.e.
the list of the variable names that are comma serparated.
Definition at line 2050 of file cprettyprinter.c.
References argument_p(), s_ppt::c, c_entity_local_name(), code_declarations, code_undefined, concatenate(), ENTITY, entity_initial, entity_type, FOREACH, free(), module, pips_assert, strdup(), type_functional_p, value_code, and value_code_p.
Referenced by interface_code_string().
t,the | type to be converted to its string representation |
value,set | to true if the associated argument is passed by value (i.e. not by pointer) |
Definition at line 1979 of file cprettyprinter.c.
References interface_basic_string(), is_type_variable, is_type_void, pips_user_error, strdup(), type_tag, type_variable, and variable_basic.
Referenced by interface_argument_type_string(), and interface_basic_string().
Definition at line 786 of file cprettyprinter.c.
References parameter_p(), and variable_p().
Referenced by c_code_string().
Constant variables
Definition at line 771 of file cprettyprinter.c.
References entity_initial, entity_storage, entity_type, storage_rom_p, type_functional_p, and value_symbolic_p.
Referenced by parameter_or_variable_p().
Definition at line 990 of file cprettyprinter.c.
References c_expression(), CAR, CDR, CLOSEPAREN, concatenate(), EMPTY, EXPRESSION, expression_needs_parenthesis_p(), free(), gen_length(), OPENPAREN, pips_assert, s1, SPACE, and strdup().
Referenced by expression_needs_parenthesis_p().
SG: PBM spotted HERE.
Attention: not like this for io statements
Definition at line 1039 of file cprettyprinter.c.
References c_expression(), CLOSEPAREN, concatenate(), EXPRESSION, expression_scalar_p, FOREACH, free(), get_bool_property(), NIL, OPENPAREN, and strdup().
Referenced by ppt_math(), and ppt_unknown().
Definition at line 1121 of file cprettyprinter.c.
References basic_maximum(), basic_overloaded_p, basic_undefined, copy_basic(), exp, EXPRESSION, expression_to_type(), FOREACH, free(), free_basic(), free_type(), gen_length(), get_c_full_name(), pips_assert, pips_debug, ppt_call(), strdup(), type_variable, type_variable_p, and variable_basic.
Definition at line 1156 of file cprettyprinter.c.
References c_expression(), CAR, CLOSEPAREN, concatenate(), exp, EXPRESSION, expression_scalar_p, FOREACH, free(), get_bool_property(), OPENPAREN, pips_assert, POP, and strdup().
Definition at line 1018 of file cprettyprinter.c.
References c_expression(), CAR, concatenate(), EXPRESSION, free(), gen_length(), pips_assert, SPACE, and strdup().
Definition at line 1028 of file cprettyprinter.c.
References c_expression(), CAR, concatenate(), EXPRESSION, free(), gen_length(), pips_assert, SPACE, and strdup().
in_f,the | instrinsic in fortran |
Definition at line 1185 of file cprettyprinter.c.
References get_bool_property(), pips_user_error, and ppt_call().
bool print_c_code | ( | const char * | module_name | ) |
C indentation thru indent.
module_name | odule_name |
Definition at line 2262 of file cprettyprinter.c.
References concatenate(), CPRETTY, db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, free(), INDENT, module_name(), safe_system(), and strdup().
bool print_crough | ( | const char * | module_name | ) |
save to file
module_name | odule_name |
Definition at line 2194 of file cprettyprinter.c.
References build_written_list(), c_code_string(), concatenate(), CROUGH, db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, debug_off, debug_on, effects_to_list(), entity_name, fprintf(), free(), gen_free_list(), gen_free_string_list(), l_entity, l_name, l_rename, l_type, l_written, module, module_name(), module_name_to_entity(), NIL, out, pips_debug, reset_current_module_entity(), reset_current_module_statement(), safe_fclose(), safe_fopen(), set_current_module_entity(), set_current_module_statement(), and strdup().
bool print_interface | ( | const char * | module_name | ) |
save to file
module_name | odule_name |
Definition at line 2151 of file cprettyprinter.c.
References concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, debug_off, debug_on, entity_name, fprintf(), free(), INTERFACE, interface_code_string(), module, module_name(), module_name_to_entity(), out, pips_debug, reset_current_module_entity(), reset_current_module_statement(), safe_fclose(), safe_fopen(), set_current_module_entity(), set_current_module_statement(), and strdup().
we want to decide if a scalar variable need to be passed by pointer or by value to a C function.
Fortran77 assumes that all scalars are passed by pointer. Starting With Fotran95, the arguments can be passed by value by using interfaces.
var,the | variable to be test as an entity |
Definition at line 280 of file cprettyprinter.c.
References get_bool_property(), and written_p().
Referenced by this_entity_cdeclaration().
|
static |
Definition at line 248 of file cprettyprinter.c.
References cons::cdr, concatenate(), entity_local_name(), free(), gen_car(), l_entity, l_name, l_rename, NIL, pips_debug, strdup(), and written_p().
Referenced by c_call().
|
static |
Definition at line 231 of file cprettyprinter.c.
References cons::cdr, concatenate(), free(), gen_car(), l_name, l_rename, l_type, NIL, SPACE, and strdup().
Referenced by c_code_string().
var,the | variable to get the c declaration |
fct_sig,set | to true if the variable is part of a function signature |
Many possible combinations
This is a typedef name, what about typedef int myint[5] ???
hat about real, double, string, ... ?
ram r = storage_ram(s); entity sec = ram_section(r); if ((sec == CurrentSourceFileStaticArea) || (sec == CurrentStaticArea)) result = "static ";
problems with order !
It is an expression...
Definition at line 578 of file cprettyprinter.c.
References asprintf, basic_bit, basic_bit_p, basic_to_string(), brace_expression_p(), c_basic_string(), c_brace_expression_string(), c_dim_string(), c_entity_local_name(), c_qualifier_string(), c_type_string(), concatenate(), constant_int, constant_int_p, ENTITY, entity_basic(), entity_initial, entity_name, entity_storage, entity_type, exp, expression_to_string(), free(), gen_entity_cons(), gen_string_cons(), get_bool_property(), get_prettyprint_language_tag(), int2a(), is_language_c, is_storage_ram, is_storage_rom, is_type_enum, is_type_struct, is_type_union, is_type_variable, l_entity, l_name, l_rename, l_type, MAP, NIL, NL, pips_debug, scalar_by_pointer(), SCALAR_IN_SIG_EXT, SEMICOLON, set_prettyprint_language_tag(), SPACE, storage_tag, strdup(), symbolic_constant, type_enum, type_struct, type_tag, type_union, type_variable, typedef_entity_p(), user_error, value_constant, value_constant_p, value_expression, value_expression_p, value_symbolic, value_symbolic_p, value_undefined_p, variable_basic, variable_dimensions, and variable_qualifiers.
Referenced by c_declarations(), and c_statement().
Definition at line 779 of file cprettyprinter.c.
References entity_storage, entity_type, storage_ram_p, storage_return_p, and type_variable_p.
Referenced by parameter_or_variable_p().
Definition at line 226 of file cprettyprinter.c.
References gen_in_list_p(), and l_written.
Referenced by scalar_by_pointer(), and scalar_postlude().
|
static |
Definition at line 1072 of file cprettyprinter.c.
Referenced by get_c_full_name().
|
static |
Definition at line 1196 of file cprettyprinter.c.
Referenced by get_ppt().
Definition at line 107 of file cprettyprinter.c.
Referenced by print_crough(), scalar_postlude(), and this_entity_cdeclaration().
Definition at line 105 of file cprettyprinter.c.
Referenced by print_crough(), scalar_postlude(), scalar_prelude(), and this_entity_cdeclaration().
Definition at line 106 of file cprettyprinter.c.
Referenced by print_crough(), scalar_postlude(), scalar_prelude(), and this_entity_cdeclaration().
Definition at line 104 of file cprettyprinter.c.
Referenced by print_crough(), scalar_prelude(), and this_entity_cdeclaration().
Definition at line 108 of file cprettyprinter.c.
Referenced by build_written_list(), print_crough(), and written_p().