PIPS
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "parser_private.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "misc.h"
#include "properties.h"
#include "syntax.h"
Go to the source code of this file.
Data Structures | |
struct | macro_t |
Functions | |
void | parser_init_macros_support (void) |
next available chunk More... | |
void | parser_close_macros_support (void) |
static macro_t * | find_entity_macro (entity e) |
bool | parser_entity_macro_p (entity e) |
void | parser_add_a_macro (call c, expression e) |
static bool | call_flt (call c) |
static bool | untrusted_call_p (expression e) |
static bool | expr_flt (expression e) |
static void | expr_rwt (expression e) |
static void | substitute_expression_in_expression (expression tree, expression initial, expression replacement) |
substitutes occurences of initial by replacement in tree More... | |
void | reset_substitute_expression_in_expression (void) |
void | parser_macro_expansion (expression e) |
void | parser_substitute_all_macros (statement s) |
void | parser_substitute_all_macros_in_expression (expression e) |
Variables | |
static macro_t * | current_macros |
static int | current_macros_size = 0 |
static int | current_macro_index = 0 |
static bool | some_call |
is there a call to some untrusted function? More... | |
static expression | s_init = expression_undefined |
must take care not to substitute in an inserted expression More... | |
static expression | s_repl = expression_undefined |
static list | already_subs = NIL |
of expression More... | |
else untrusted!
Definition at line 152 of file macros.c.
References call_function, entity_initial, gen_recurse_stop(), some_call, value_constant_p, value_intrinsic_p, and value_symbolic_p.
Referenced by untrusted_call_p().
|
static |
Definition at line 180 of file macros.c.
References already_subs, and gen_in_list_p().
Referenced by substitute_expression_in_expression().
|
static |
Definition at line 185 of file macros.c.
References already_subs, CONS, copy_syntax(), EXPRESSION, expression_equal_p(), expression_syntax, free_syntax(), s_init, and s_repl.
Referenced by substitute_expression_in_expression().
not found
Definition at line 98 of file macros.c.
References call_function, current_macro_index, current_macros, and same_entity_p().
Referenced by parser_add_a_macro(), parser_entity_macro_p(), and parser_macro_expansion().
void parser_add_a_macro | ( | call | c, |
expression | e | ||
) |
resize!
expand macros in the macro! It is ok, because referenced macros must appear in preceding lines (F77 15-5, line 3-5).
store the result.
Definition at line 113 of file macros.c.
References call_function, current_macro_index, current_macros, current_macros_size, entity_name, find_entity_macro(), macro_t::lhs, parser_substitute_all_macros_in_expression(), ParserError(), pips_assert, pips_debug, pips_user_warning, and macro_t::rhs.
Referenced by MakeAssignInst().
void parser_close_macros_support | ( | void | ) |
what about the entity? It might exist such a real top-level entity... what if added as a callee... the entity should be destroyed... best would be to have it as a local entity, and have the calles and top-level updates delayed.
Definition at line 72 of file macros.c.
References call_function, current_macro_index, current_macros, free_call(), free_expression(), macro_t::lhs, pips_debug, and remove_from_called_modules().
Referenced by EndOfProcedure().
Definition at line 108 of file macros.c.
References find_entity_macro().
void parser_init_macros_support | ( | void | ) |
next available chunk
??? memory leak...
Definition at line 57 of file macros.c.
References current_macro_index, current_macros, current_macros_size, malloc(), pips_assert, and pips_debug.
Referenced by the_actual_parser().
void parser_macro_expansion | ( | expression | e | ) |
of expression
get the macro definition.
duplicated, for latter subs.
replace each formal by its actual.
MUST be a simple reference
if the replacement is a constant, or a reference without calls to external functions, it should be safe
it is important to keep the same expression, for gen_recurse use.
Definition at line 224 of file macros.c.
References call_arguments, call_function, CAR, copy_expression(), ENDP, entity_name, EXPRESSION, expression_call_p(), expression_reference_p(), expression_syntax, find_entity_macro(), free(), free_syntax(), gen_length(), macro_t::lhs, module_local_name(), pips_assert, pips_debug, pips_user_warning, POP, reference_indices, reset_substitute_expression_in_expression(), macro_t::rhs, substitute_expression_in_expression(), syntax_call, syntax_reference, syntax_undefined, and untrusted_call_p().
Referenced by parser_substitute_all_macros().
void parser_substitute_all_macros | ( | statement | s | ) |
Definition at line 294 of file macros.c.
References current_macro_index, expression_domain, gen_recurse, gen_true(), get_bool_property(), and parser_macro_expansion().
Referenced by EndOfProcedure(), and parser_substitute_all_macros_in_expression().
void parser_substitute_all_macros_in_expression | ( | expression | e | ) |
Definition at line 302 of file macros.c.
References parser_substitute_all_macros().
Referenced by parser_add_a_macro().
void reset_substitute_expression_in_expression | ( | void | ) |
Definition at line 218 of file macros.c.
References already_subs, gen_free_list(), and NIL.
Referenced by parser_macro_expansion().
|
static |
substitutes occurences of initial by replacement in tree
pips_debug(8, "tree/initial/replacement\n");
print_expression(tree);
print_expression(initial);
print_expression(replacement);
}
Definition at line 197 of file macros.c.
References expr_flt(), expr_rwt(), expression_domain, expression_undefined, gen_recurse, s_init, and s_repl.
Referenced by parser_macro_expansion().
|
static |
Definition at line 164 of file macros.c.
References call_domain, call_flt(), gen_null(), gen_recurse, and some_call.
Referenced by parser_macro_expansion().
of expression
Definition at line 178 of file macros.c.
Referenced by expr_flt(), expr_rwt(), and reset_substitute_expression_in_expression().
|
static |
Definition at line 55 of file macros.c.
Referenced by find_entity_macro(), parser_add_a_macro(), parser_close_macros_support(), parser_init_macros_support(), and parser_substitute_all_macros().
|
static |
Definition at line 53 of file macros.c.
Referenced by find_entity_macro(), parser_add_a_macro(), parser_close_macros_support(), and parser_init_macros_support().
|
static |
Definition at line 54 of file macros.c.
Referenced by parser_add_a_macro(), and parser_init_macros_support().
|
static |
must take care not to substitute in an inserted expression
Definition at line 177 of file macros.c.
Referenced by expr_rwt(), MakeAssignedOrComputedGotoInst(), and substitute_expression_in_expression().
|
static |
Definition at line 177 of file macros.c.
Referenced by expr_rwt(), and substitute_expression_in_expression().
|
static |
is there a call to some untrusted function?
Definition at line 150 of file macros.c.
Referenced by call_flt(), and untrusted_call_p().