PIPS
|
Simple phases to show how to add stuff to a module: a comment, a call,... More...
Functions | |
bool | prepend_comment (char *module_name) |
Add a comment at the begin of a module code. More... | |
bool | prepend_call (string mn) |
This function adds a call to ficticious global function "MY_TRACK" as first executabble statement of module "mn" in C89 style. More... | |
static void | do_add_pragma (statement s, statement p) |
bool | add_pragma (const string mn) |
Simple phases to show how to add stuff to a module: a comment, a call,...
Pedagogical, but also useful for RK for a project...
Ronan François Irigoin .Ker yell@ hpc- proje ct.c om
This module introduces some pedagogical minimal phases to dive into PIPS development, with some examples of programming and documentation style (such as this module itself!)
a bit more complex: the directive must be added just before any return statement, if any
Definition at line 110 of file add_stuff_to_module.c.
References add_pragma_str_to_statement(), do_add_pragma(), gen_context_recurse, gen_true2(), get_bool_property(), get_string_property(), insert_statement(), make_empty_statement, module_statement, PIPS_PHASE_POSTLUDE, PIPS_PHASE_PRELUDE, and statement_domain.
Definition at line 104 of file add_stuff_to_module.c.
References copy_statement(), insert_statement(), and return_statement_p().
Referenced by add_pragma().
This function adds a call to ficticious global function "MY_TRACK" as first executabble statement of module "mn" in C89 style.
It is not supposed to be of any use beyond training new comers to PIPS.
Function "MY_TRACK" is assumed to take no arguments and to return no results. No source code is available for it.
It is written to show how to use Newgen primitives in PIPS PPoPP 2010 tutorial, not to be used. See make_empty_subroutine() in ri-util/entity.c for a similar function which might be moved into ri-util/module.c.
mn | is the name of the module to apply this phase on. |
This works only once. So use FindOrCreateEntity() instead... or rely on functions in library ri-util.
Definition at line 77 of file add_stuff_to_module.c.
References check_entity(), compute_callees(), concatenate(), DB_PUT_MEMORY_RESOURCE, f(), get_string_property(), insert_statement(), instruction_to_statement(), make_call(), make_code(), make_entity, make_functional(), make_instruction_call(), make_language_c(), make_sequence(), make_storage_rom(), make_type_functional(), make_type_void(), make_value_code(), MODULE_SEP_STRING, module_statement, NIL, pips_assert, PIPS_PHASE_POSTLUDE, PIPS_PHASE_PRELUDE, strdup(), and TOP_LEVEL_MODULE_NAME.
bool prepend_comment | ( | char * | module_name | ) |
Add a comment at the begin of a module code.
It is a pedagogical phase but is also used for CUDA generation.
module_name | is the name of the module to apply this phase on. |
Use this module name and this environment variable to set
Put back the new statement for the module
Definition at line 42 of file add_stuff_to_module.c.
References comment(), get_string_property(), insert_comments_to_statement(), module_name(), module_statement, PIPS_PHASE_POSTLUDE, and PIPS_PHASE_PRELUDE.