PIPS
|
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "database.h"
#include "misc.h"
#include "ri-util.h"
#include "effects-util.h"
#include "constants.h"
#include "text-util.h"
#include "text.h"
#include "control.h"
#include "properties.h"
#include "pipsdbm.h"
#include "resources.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "scalopes_private.h"
Go to the source code of this file.
Functions | |
static bool | sesam_task_label_p (entity e) |
returns true if the input label entity name is prefixed by SCALOPES_KERNEL_TASK_PREFIX More... | |
static void | sbp_context_init (sesam_buffers_processing_context *sbp_context) |
initalizes the object describing how the targeted sesam application uses buffers all sets and hash tables are emtpy at the beginning. More... | |
static entity | sesam_buffer_to_server_entity (entity buffer) |
retrieves the original entity from an entity generated by isolate_statement More... | |
static bool | entity_sesam_buffer_p (entity e) |
returns true if the entity name is prefixed by ISOLATE_STATEMENT_VAR_PREFIX. More... | |
static void | sbp_context_add_kernel_task_buffer (sesam_buffers_processing_context *sbp_context, entity k_task, entity buffer, bool in_p) |
updates sbp_context knowing that buffer will be a buffer (input if in_p is true, output otherwise) of kernel task k_task More... | |
static bool | update_sesam_tasks_buffers (statement stmt, sesam_buffers_processing_context *sbp_context) |
update the object describing how the targeted sesam application uses buffers with the current statement characteristics More... | |
static void | print_entity_task_buffers (FILE *fp, set tasks, entity_task_buffers tasks_to_buffers, list l_buffers, const char *task_prefix) |
prettyprints in input file how each task uses the buffers More... | |
static void | print_sesam_tasks_buffers_header (const char *module_name, sesam_buffers_processing_context sbp_context) |
prints a header file describing how the targeted sesam application uses buffers More... | |
bool | sesam_buffers_processing (const char *module_name) |
PIPS phase that takes a module transformed by isolated statements and produces a header file describing buffer usage for targeted sesam application. More... | |
bool | sesam_servers_processing (const char *module_name) |
returns true if the entity name is prefixed by ISOLATE_STATEMENT_VAR_PREFIX.
Definition at line 130 of file sesam_tasks_processing.c.
References entity_user_name(), get_string_property(), pips_debug, and prefix.
Referenced by update_sesam_tasks_buffers().
|
static |
prettyprints in input file how each task uses the buffers
fp | is the File pointer |
tasks_to_buffers | is the hash table giving the input and output buffers of each task |
l_buffers | is an ordered list of buffers |
task_prefix | is a string appended before the task names |
Then for each task: (sorted before) print #ifdef "task_prefix""task_name" for each buffer in l_buffers if buffer belongs to task input buffers print #define buffer_cons_p 1 else print #define buffer_cons_p 0 if buffer belongs to task output buffers print #define buffer_prod_p 1 else print #define buffer_prod_p 0 print #endif
Definition at line 290 of file sesam_tasks_processing.c.
References apply_entity_task_buffers(), buf, compare_entities(), ENTITY, entity_user_name(), FOREACH, fprintf(), gen_free_list(), set_belong_p(), set_to_sorted_list(), task_buffers_input, and task_buffers_output.
Referenced by print_sesam_tasks_buffers_header().
|
static |
prints a header file describing how the targeted sesam application uses buffers
module_name | is the current module name |
sbp_context | is the object describing how the targeted sesam application uses buffers |
first sort buffers list so that buffers are always printed in the same order
Then generate buffer identifiers values:
for each buffer in buffer list print #define buffer value value ++
Then for each kernel task: (sorted before) print #ifdef task_name for each buffer in buffer list if buffer belongs to task input buffers print #define buffer_cons_p 1 else print #define buffer_cons_p 0 if buffer belongs to task output buffers print #define buffer_prod_p 1 else print #define buffer_prod_p 0 print #endif
Then do the same for server tasks
Definition at line 330 of file sesam_tasks_processing.c.
References buf, compare_entities(), concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), DB_PUT_FILE_RESOURCE, ENTITY, entity_user_name(), FOREACH, fprintf(), free(), gen_free_list(), gen_length(), get_string_property(), int2a(), module_name(), prefix, print_entity_task_buffers(), safe_fclose(), safe_fopen(), sesam_buffers_processing_context_buffers, sesam_buffers_processing_context_kernel_buffers, sesam_buffers_processing_context_kernel_tasks, sesam_buffers_processing_context_server_buffers, sesam_buffers_processing_context_server_tasks, set_to_sorted_list(), and strdup().
Referenced by sesam_buffers_processing().
|
static |
updates sbp_context knowing that buffer will be a buffer (input if in_p is true, output otherwise) of kernel task k_task
sbp_context | is the object describing how the targeted sesam application uses buffers |
k_task | is the kernel task label, used here as an identifier |
buffer | is the pointer to the buffer, used here as an identifier |
in_p | is a bool true if the buffer is an input buffer of the task |
This function:
This is an unoptimized version: servers are systematically used for original variables.
first add the buffer to the set of buffers
Then add it in the task input (resp. ouput) buffers if in_p is true (resp. false)
if the task has not yet been encountered, then add an entry in the kernel task set and buffers first
Finally, retrieve the original variable corresponding to the buffer and add it in the server task ouput (resp. input) buffers if in_p is true (resp. false).
if the server task has not yet been encountered, then add an entry in the server task sets and buffers first
Definition at line 162 of file sesam_tasks_processing.c.
References apply_entity_task_buffers(), bound_entity_task_buffers_p(), buffer, extend_entity_task_buffers(), make_task_buffers(), sesam_buffer_to_server_entity(), sesam_buffers_processing_context_buffers, sesam_buffers_processing_context_kernel_buffers, sesam_buffers_processing_context_kernel_tasks, sesam_buffers_processing_context_server_buffers, sesam_buffers_processing_context_server_tasks, set_add_element(), set_make(), set_pointer, task_buffers_input, and task_buffers_output.
Referenced by update_sesam_tasks_buffers().
|
static |
initalizes the object describing how the targeted sesam application uses buffers all sets and hash tables are emtpy at the beginning.
Definition at line 73 of file sesam_tasks_processing.c.
References make_entity_task_buffers(), make_sesam_buffers_processing_context(), set_make(), and set_pointer.
Referenced by sesam_buffers_processing().
retrieves the original entity from an entity generated by isolate_statement
try to find it in the current module
try to find a global variable
Definition at line 86 of file sesam_tasks_processing.c.
References buffer, entity_undefined_p, entity_user_name(), FindEntity(), FindEntityFromUserName(), free(), get_current_module_name(), get_string_property(), ifdebug, pips_assert, pips_debug, prefix, strndup(), and TOP_LEVEL_MODULE_NAME.
Referenced by sbp_context_add_kernel_task_buffer().
bool sesam_buffers_processing | ( | const char * | module_name | ) |
PIPS phase that takes a module transformed by isolated statements and produces a header file describing buffer usage for targeted sesam application.
module_name | is the current module name |
module_name | odule_name |
Definition at line 420 of file sesam_tasks_processing.c.
References db_get_memory_resource(), free_sesam_buffers_processing_context(), gen_context_recurse, gen_null2(), module_name(), module_statement, PIPS_PHASE_POSTLUDE, PIPS_PHASE_PRELUDE, print_sesam_tasks_buffers_header(), reset_cumulated_rw_effects(), reset_methods_for_effects_prettyprint(), sbp_context_init(), sesam_buffers_processing_context_undefined, set_cumulated_rw_effects(), set_methods_for_rw_effects_prettyprint(), statement_domain, and update_sesam_tasks_buffers().
bool sesam_servers_processing | ( | const char * | module_name | ) |
module_name | odule_name |
Definition at line 449 of file sesam_tasks_processing.c.
References module_name(), module_statement, PIPS_PHASE_POSTLUDE, and PIPS_PHASE_PRELUDE.
returns true if the input label entity name is prefixed by SCALOPES_KERNEL_TASK_PREFIX
Definition at line 61 of file sesam_tasks_processing.c.
References entity_user_name(), get_string_property(), and prefix.
Referenced by update_sesam_tasks_buffers().
|
static |
update the object describing how the targeted sesam application uses buffers with the current statement characteristics
isolate_statement generates pointers to the actual buffers. do not consider effects on them, but only on the buffers themselves
Definition at line 233 of file sesam_tasks_processing.c.
References EFFECT, effect_any_reference, effect_entity(), effect_read_p, ENDP, entity_name, entity_sesam_buffer_p(), entity_user_name(), FOREACH, load_cumulated_rw_effects_list(), pips_debug, pips_debug_effect, reference_indices, sbp_context_add_kernel_task_buffer(), sesam_task_label_p(), and statement_label.
Referenced by sesam_buffers_processing().