25 #include "pips_config.h"
55 #define GET_RC_PREFIX "GET_"
56 #define SET_RC_PREFIX "SET_"
61 substitute_rc_p = (strcmp(option,
"RC")==0) || (strcmp(option,
"HRC")==0) ;
66 user_log(
"Unknown option \"%s\" for property "
67 "PARSER_SUBSTITUTE_ALTERNATE_RETURNS.\n"
68 "Three options are available for alternate return handling: "
69 "\"NO\", \"RC\" and \"STOP\"\n", option);
70 ParserError(
"SubstituteAlternateReturns",
"Illegal property value");
76 "Module declarations should be regenerated."
77 " Set property PRETTYPRINT_ALL_DECLARATIONS.\n");
175 (
"Lines %d-%d: Alternate return not processed with current option \"%s\". "
176 "Formal label * ignored.\n"
177 "See property PARSER_SUBSTITUTE_ALTERNATE_RETURNS for other options\n",
179 ParserError(
"uses_alternate_return",
"Alternate returns prohibited by user\n");
251 pips_user_warning(
"Lines %d-%d: Alternate return towards label %s not supported. "
252 "Actual label argument internally substituted by a character string.\n",
451 "Lines %d-%d: Alternate return not supported. "
452 "Standard return generated\n",
void user_log(const char *format,...)
bool instruction_consistent_p(instruction p)
functional make_functional(list a1, type a2)
call make_call(entity a1, list a2)
value make_value_unknown(void)
parameter make_parameter(type a1, mode a2, dummy a3)
mode make_mode(enum mode_utype tag, void *val)
basic make_basic(enum basic_utype tag, void *val)
storage make_storage(enum storage_utype tag, void *val)
ram make_ram(entity a1, entity a2, intptr_t a3, list a4)
value make_value(enum value_utype tag, void *val)
variable make_variable(basic a1, list a2, list a3)
instruction make_instruction(enum instruction_utype tag, void *val)
dummy make_dummy_unknown(void)
type make_type(enum type_utype tag, void *val)
cons * arguments_add_entity(cons *a, entity e)
expression MakeCharacterConstantExpression(string s)
END_EOLE.
const char * module_name(const char *s)
Return the module part of an entity name.
char * get_string_property(const char *)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
const char * get_current_module_name(void)
Get the name of the current module.
instruction make_instruction_block(list statements)
Build an instruction block from a list of statements.
#define ENDP(l)
Test if a list is empty.
#define list_undefined_p(c)
Return if a list is undefined.
#define NIL
The empty list (nil in Lisp)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
void gen_free_list(list l)
free the spine of the list
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
#define list_undefined
Undefined list definition :-)
statement make_assign_statement(expression, expression)
#define src(name, suf)
HPFC by Fabien Coelho, May 1993 and later...
#define pips_user_warning
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
#define user_error(fn,...)
#define user_warning(fn,...)
#define RETURN_LABEL_NAME
#define DYNAMIC_AREA_LOCAL_NAME
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
string concatenate(const char *,...)
Return the concatenation of the given strings.
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
void update_called_modules(entity e)
int get_statement_number()
eturn the line number of the statement being parsed
#define instruction_block_p(i)
#define instruction_block(i)
entity FindEntity(const char *package, const char *name)
Retrieve an entity from its package/module name and its local name.
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
entity FindOrCreateEntity(const char *package, const char *local_name)
Problem: A functional global entity may be referenced without parenthesis or CALL keyword in a functi...
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
const char * label_local_name(entity e)
END_EOLE.
bool expression_call_p(expression e)
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
int add_variable_to_area(entity, entity)
type MakeTypeVariable(basic, cons *)
BEGIN_EOLE.
#define entity_storage(x)
#define EXPRESSION(x)
EXPRESSION.
#define instruction_undefined
#define type_undefined_p(x)
#define entity_undefined_p(x)
#define expression_undefined
#define PARAMETER(x)
PARAMETER.
#define expression_undefined_p(x)
#define statement_number(x)
#define expression_syntax(x)
#define statement_undefined
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
The structure used to build lists in NewGen.
int line_b_I
Indicates where the current instruction (in fact statement) starts and ends in the input file and giv...
bool ParserError(const char *f, const char *m)
void set_current_number_of_alternate_returns()
void soft_reset_alternate_returns()
ParserError() cannot guess if it has been performed or not, because it is reinitialized before and af...
static bool substitute_stop_p
void SubstituteAlternateReturns(const char *option)
return.c
static list alternate_returns
Keep track of the labels used as actual arguments for alternate returns and generate the tests to che...
LOCAL char * end_label_local_name
static entity GetFullyDefinedReturnCodeVariable()
bool SubstituteAlternateReturnsP()
void set_alternate_returns()
list add_actual_return_code(list apl)
instruction generate_return_code_checks(list labels)
void uses_alternate_return(bool use)
entity GetReturnCodeVariable()
static int current_number_of_alternate_returns
The current number of alternate returns is used to process a module declaration.
static entity return_code_variable
Variable used to carry return code replacing the alternate returns.
list add_formal_return_code(list fpl)
Update the formal and actual parameter lists by adding the return code variable as last argument.
void ResetReturnCodeVariable()
void GenerateReturn()
Generate a unique call to RETURN per module.
void add_alternate_return(string label_name)
static statement make_set_rc_statement(expression e)
The return code may be directly assigned or indirectly through a PIPS run-time function call.
bool ReturnCodeVariableP(entity rcv)
bool uses_alternate_return_p()
static entity set_rc_function()
void reset_alternate_returns()
LOCAL entity end_label
This function creates a goto instruction to label end_label.
list get_alternate_returns()
static bool substitute_rc_p
Handling of RETURN statements and substitution of alternate returns.
instruction MakeReturn(expression e)
int get_current_number_of_alternate_returns()
void reset_current_number_of_alternate_returns()
static bool current_module_uses_alternate_returns
Remember if the current module uses alternate returns.
static statement make_get_rc_statement(expression rc_ref)
statement MakeStatement(entity l, instruction i)
This function makes a statement.
instruction MakeZeroOrOneArgCallInst(char *s, expression e)
this function creates a simple Fortran statement such as RETURN, CONTINUE, ...
entity MakeLabel(char *s) const
This functions creates a label.
instruction MakeComputedGotoInst(list ll, expression e)
instruction MakeGotoInst(string n)
this function creates a goto instruction.
void LinkInstToCurrentBlock(instruction i, bool number_it)
this function links the instruction i to the current block of statements.