PIPS
|
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "private.h"
#include "methods.h"
#include <sys/stat.h>
#include <unistd.h>
Go to the source code of this file.
Data Structures | |
struct | methods |
Macros | |
#define | no_read (READER) abort |
#define | no_write (WRITER) abort |
#define | DEFAULT_OWNER_NAME WORKSPACE_PROGRAM_SPACE |
Typedefs | |
typedef char *(* | READER) (FILE *) |
typedef void(* | WRITER) (FILE *, void *) |
typedef void(* | FREER) (void *) |
typedef bool(* | CHECKER) (void *) |
Functions | |
static void | no_free (void *p) |
static void | writeln_string (FILE *f, void *p) |
static void | unexpected (void) |
void | pipsdbm_write_statement_mapping (FILE *, statement_mapping) |
Write a statement mapping. More... | |
hash_table | pipsdbm_read_statement_mapping (FILE *) |
Read a statement mapping. More... | |
bool | pipsdbm_check_statement_mapping (statement_mapping) |
a little bit partial, because domain are not checked. More... | |
void | pipsdbm_free_statement_mapping (statement_mapping) |
void | free_static_control_mapping (statement_mapping) |
Modification Dec 11 1995: ne pas utiliser free_static_control car il libere des champs qui appartiennent a d'autres structures que celles controlees par static_controlize...(champs d'origine) Les liberation de ces champs par un autre transformer (use_def_elim) entrainait alors un core dump au niveau de cette procedure. More... | |
static methods * | get_methods (const char *name) |
gcc version More... | |
int | dbll_number_of_resources (void) |
string | dbll_get_ith_resource_name (int i) |
bool | dbll_very_special_resource_p (const char *rname, const char *oname) |
void | db_set_current_builder_name (const char *name) |
void | db_reset_current_builder_name (void) |
string | db_get_current_builder_name (void) |
string | db_get_directory_name_for_module (const char *name) |
returns the allocated and mkdir'ed directory for module name More... | |
string | db_build_file_resource_name (const char *rname, const char *oname, const char *suffix) |
returns an allocated file name for a file resource. More... | |
string | get_resource_file_name (const char *rname, const char *oname) |
allocate a full file name for the given resource. More... | |
static FILE * | open_resource_file (const char *rname, const char *oname, const char *what) |
static void | close_resource_file (FILE *file, const char *rname, const char *oname) |
void | dbll_unlink_resource_file (const char *rname, const char *oname, bool erroriffailed) |
static int | dbll_stat_file (const char *file_name, bool okifnotthere) |
returns 0 on errors (say no file). More... | |
int | dbll_stat_local_file (const char *file_name, bool okifnotthere) |
It is impportant that the workspace directory does not appear in the file name so as to allow workspaces to be moveable. More... | |
int | dbll_stat_resource_file (const char *rname, const char *oname, bool okifnotthere) |
void | dbll_save_resource (const char *rname, const char *oname, void *p) |
save rname of oname p. More... | |
void * | dbll_load_resource (const char *rname, const char *oname) |
void | dbll_free_resource (const char *rname, const char *oname, void *p) |
bool | dbll_check_resource (const char *rname, const char *oname, void *p) |
Internal consistency of the resource, not the global consistency wrt other resources and pipsmake rules which is managed by the pipsmake library at a higher level. More... | |
bool | dbll_storable_p (const char *rname) |
void | dbll_save_and_free_resource (const char *rname, const char *oname, void *p, bool do_free) |
bool | displayable_file_p (const char *name) |
rather approximated. More... | |
bool | dbll_database_managed_file_p (const char *name) |
returns whether the file is managed within the database. More... | |
Variables | |
const char * | dbll_current_module = (const char*) NULL |
the current module is expected by some load/save functions... More... | |
static methods | all_methods [] |
sigh... More... | |
static char * | current_builder = NULL |
#define DEFAULT_OWNER_NAME WORKSPACE_PROGRAM_SPACE |
Definition at line 146 of file lowlevel.c.
Definition at line 57 of file lowlevel.c.
Definition at line 58 of file lowlevel.c.
typedef bool(* CHECKER) (void *) |
Definition at line 46 of file lowlevel.c.
typedef void(* FREER) (void *) |
Definition at line 45 of file lowlevel.c.
typedef char*(* READER) (FILE *) |
Definition at line 43 of file lowlevel.c.
typedef void(* WRITER) (FILE *, void *) |
Definition at line 44 of file lowlevel.c.
|
static |
Definition at line 206 of file lowlevel.c.
References file_name, free(), get_resource_file_name(), and safe_fclose().
Referenced by dbll_load_resource(), and dbll_save_resource().
string db_build_file_resource_name | ( | const char * | rname, |
const char * | oname, | ||
const char * | suffix | ||
) |
returns an allocated file name for a file resource.
may depend on the current builder, someday. this function is to be used by all phases that generate files. it does not include the directory for movability
mkdir as a side effect.
the next name must be compatible with the Display script... it may depend on the builder function maybe (if pipsmake tells) may include the resource name? as lower letters?
rname | name |
oname | name |
suffix | uffix |
Definition at line 169 of file lowlevel.c.
References concatenate(), db_get_directory_name_for_module(), DEFAULT_OWNER_NAME, free(), pips_debug, same_string_p, and strdup().
Referenced by actual_symbol_table_dump(), add_new_compilation_unit(), add_new_module_from_text(), filter_file(), flinter(), full_graph_of_calls(), generic_print_xml_application(), gpu_xml_dump(), graph_of_calls(), html_prettyprint(), html_prettyprint_symbol_table(), loop_statistics(), make_resource_from_starting_node(), make_text_resource(), module_to_callgraph(), print_c_code(), print_code_smalltalk(), print_crough(), print_dependence_or_chains_graph(), print_dot_dependence_or_chains_graph(), print_filtered_dg_or_dvdg(), print_interface(), print_loopnest_dependence_cone(), print_loops(), print_sesam_tasks_buffers_header(), print_xml_code(), print_xml_code_with_explicit_motif(), process_user_file(), step_compile(), store_new_module(), and unsplit_internal().
string db_get_current_builder_name | ( | void | ) |
Definition at line 140 of file lowlevel.c.
References current_builder, and pips_assert.
string db_get_directory_name_for_module | ( | const char * | name | ) |
returns the allocated and mkdir'ed directory for module name
MKDIR
name | ame |
Definition at line 150 of file lowlevel.c.
References concatenate(), create_directory(), db_get_current_workspace_directory(), directory_exists_p(), free(), pips_assert, pips_user_irrecoverable_error, same_string_p, and strdup().
Referenced by dag_dot_dump(), db_build_file_resource_name(), db_get_meta_data_directory(), generate_hpf_remapping_file(), get_new_tmp_file_name(), get_opencl_file_name(), get_resource_file_name(), helper_file_name(), hpfc_init(), insert_check_alias_before_statement(), insert_flag_before_call_site(), insert_test_before_caller(), insert_test_before_statement(), process_thru_C_pp(), process_thru_fortran_pp(), push_path(), step_install(), text_area_included(), unsplit_internal(), and used_before_set().
void db_reset_current_builder_name | ( | void | ) |
Definition at line 134 of file lowlevel.c.
References current_builder, free(), and pips_assert.
void db_set_current_builder_name | ( | const char * | name | ) |
name | ame |
Definition at line 128 of file lowlevel.c.
References current_builder, pips_assert, and strdup().
bool dbll_check_resource | ( | const char * | rname, |
const char * | oname, | ||
void * | p | ||
) |
Internal consistency of the resource, not the global consistency wrt other resources and pipsmake rules which is managed by the pipsmake library at a higher level.
Know right away which resource is Newgen inconsistent
FI: I find this message I have added myself pretty useless in general as a core dump occurs in case some inconsistency is found.
rname | name |
oname | name |
Definition at line 324 of file lowlevel.c.
References bool_to_string(), methods::check_function, get_methods(), and pips_debug.
Referenced by db_get_memory_resource(), and db_put_or_update_memory_resource().
bool dbll_database_managed_file_p | ( | const char * | name | ) |
returns whether the file is managed within the database.
that is it is not a SOURCE_FILE. basically SOURCE_FILEs are given relative names with leading . or /, while within the database a leading "*.database/" is always appended.
name | ame |
Definition at line 376 of file lowlevel.c.
Referenced by db_check_time().
void dbll_free_resource | ( | const char * | rname, |
const char * | oname, | ||
void * | p | ||
) |
rname | name |
oname | name |
Definition at line 313 of file lowlevel.c.
References methods::free_function, get_methods(), and pips_debug.
Referenced by db_delete_resource(), db_save_and_free_resource(), db_set_resource_as_required(), and dbll_save_and_free_resource().
Definition at line 113 of file lowlevel.c.
References all_methods, dbll_number_of_resources(), methods::name, and pips_assert.
Referenced by db_close_module(), and db_delete_all_resources().
void* dbll_load_resource | ( | const char * | rname, |
const char * | oname | ||
) |
rname | name |
oname | name |
Definition at line 294 of file lowlevel.c.
References close_resource_file(), dbll_current_module, f(), get_methods(), no_read, open_resource_file(), pips_debug, pips_internal_error, and methods::read_function.
Referenced by db_load_resource().
int dbll_number_of_resources | ( | void | ) |
I'm not sure sizeof(all_methods) is ANSI C. FC
Definition at line 108 of file lowlevel.c.
References all_methods.
Referenced by db_close_module(), db_delete_all_resources(), dbll_get_ith_resource_name(), and get_methods().
void dbll_save_and_free_resource | ( | const char * | rname, |
const char * | oname, | ||
void * | p, | ||
bool | do_free | ||
) |
rname | name |
oname | name |
do_free | o_free |
Definition at line 350 of file lowlevel.c.
References dbll_free_resource(), and dbll_save_resource().
Referenced by db_save_and_free_resource().
void dbll_save_resource | ( | const char * | rname, |
const char * | oname, | ||
void * | p | ||
) |
save rname of oname p.
get the method, then apply it.
rname | name |
oname | name |
Definition at line 275 of file lowlevel.c.
References close_resource_file(), dbll_current_module, f(), get_methods(), no_write, open_resource_file(), pips_debug, pips_user_warning, and methods::write_function.
Referenced by db_save_resource(), and dbll_save_and_free_resource().
returns 0 on errors (say no file).
otherwise returns the modification time.
some error
humm... unsigned...
Definition at line 232 of file lowlevel.c.
References buf, error, file_name, get_bool_property(), int, pips_internal_error, and pips_user_warning.
Referenced by dbll_stat_local_file(), and dbll_stat_resource_file().
It is impportant that the workspace directory does not appear in the file name so as to allow workspaces to be moveable.
file_name | ile_name |
okifnotthere | kifnotthere |
Definition at line 251 of file lowlevel.c.
References concatenate(), db_get_current_workspace_directory(), dbll_stat_file(), file_name, free(), full_name, and strdup().
Referenced by db_check_time(), db_put_or_update_memory_resource(), and db_update_time().
rname | name |
oname | name |
okifnotthere | kifnotthere |
Definition at line 265 of file lowlevel.c.
References dbll_stat_file(), file_name, free(), and get_resource_file_name().
Referenced by db_check_time(), db_clean_db_resources(), db_save_and_free_resource(), and db_save_resource().
bool dbll_storable_p | ( | const char * | rname | ) |
rname | name |
Definition at line 341 of file lowlevel.c.
References get_methods(), no_write, and methods::write_function.
Referenced by db_get_memory_resource(), db_save_and_free_resource(), and db_save_resource().
void dbll_unlink_resource_file | ( | const char * | rname, |
const char * | oname, | ||
bool | erroriffailed | ||
) |
rname | name |
oname | name |
erroriffailed | rroriffailed |
Definition at line 219 of file lowlevel.c.
References free(), full_name, get_resource_file_name(), and pips_internal_error.
Referenced by db_delete_obsolete_resources(), and db_unput_resources().
bool dbll_very_special_resource_p | ( | const char * | rname, |
const char * | oname | ||
) |
rname | name |
oname | name |
Definition at line 119 of file lowlevel.c.
References same_string_p.
Referenced by db_load_resource(), and db_save_and_free_resource().
bool displayable_file_p | ( | const char * | name | ) |
rather approximated.
beware that this function is used to check whether a resource is a file, and also to check its current time on pipsmake dependencies.
name | ame |
Definition at line 361 of file lowlevel.c.
References find_suffix(), get_methods(), methods::write_function, and writeln_string().
Referenced by db_check_time(), db_put_or_update_memory_resource(), db_save_resource(), db_time_of_resource(), db_update_time(), get_view_file(), just_show(), and show().
void free_static_control_mapping | ( | statement_mapping | map | ) |
Modification Dec 11 1995: ne pas utiliser free_static_control car il libere des champs qui appartiennent a d'autres structures que celles controlees par static_controlize...(champs d'origine) Les liberation de ces champs par un autre transformer (use_def_elim) entrainait alors un core dump au niveau de cette procedure.
On fait a la place des gen_free_list en detail –DB ]
Definition at line 318 of file externals.c.
|
static |
gcc version
return the methods for resource name
we use a local cache for fast retrieval.
initialize at first call.
get the methods!
last is unexpected
Definition at line 88 of file lowlevel.c.
References all_methods, dbll_number_of_resources(), hash_get(), hash_put(), hash_string, hash_table_make(), hash_table_undefined, hash_table_undefined_p, HASH_UNDEFINED_VALUE, and methods::name.
Referenced by dbll_check_resource(), dbll_free_resource(), dbll_load_resource(), dbll_save_resource(), dbll_storable_p(), and displayable_file_p().
string get_resource_file_name | ( | const char * | rname, |
const char * | oname | ||
) |
allocate a full file name for the given resource.
rname | name |
oname | name |
Definition at line 187 of file lowlevel.c.
References concatenate(), db_get_directory_name_for_module(), DEFAULT_OWNER_NAME, file_name, free(), same_string_p, and strdup().
Referenced by close_resource_file(), dbll_stat_resource_file(), dbll_unlink_resource_file(), f95split(), open_resource_file(), and process_user_file().
|
static |
|
static |
Definition at line 197 of file lowlevel.c.
References file_name, free(), get_resource_file_name(), and safe_fopen().
Referenced by dbll_load_resource(), and dbll_save_resource().
bool pipsdbm_check_statement_mapping | ( | statement_mapping | h | ) |
a little bit partial, because domain are not checked.
Definition at line 178 of file externals.c.
void pipsdbm_free_statement_mapping | ( | statement_mapping | h | ) |
Definition at line 190 of file externals.c.
hash_table pipsdbm_read_statement_mapping | ( | FILE * | fd | ) |
Read a statement mapping.
This function is quite too low level... It mixes raw getc() from a FILE with gen_read. To survive other NewGen backend (XML), fprintf could be replaced with a gen_getc() that could peek in a CDATA for example in the case of XML.
But in this case it should be a call to something like so = gen_read_int(fd) instead to do even simpler and read an int value (in textual form or in <int>...</int> in the case of XML.
get meta data.
Definition at line 147 of file externals.c.
void pipsdbm_write_statement_mapping | ( | FILE * | fd, |
statement_mapping | h | ||
) |
Write a statement mapping.
This function is quite too low level... It mixes raw printf in a FILE with gen_write. To survive other NewGen backend (XML), fprintf could be replaced with a gen_fprintf() that could encapsulate the output in a CDATA for example in the case of XML.
But in this case it should be a call to something like gen_write_int(fd, order) instead to do even simpler.
save it!
fd | file to write to |
h | hash table to dump |
Definition at line 115 of file externals.c.
|
static |
|
static |
Definition at line 60 of file lowlevel.c.
References f(), and fprintf().
Referenced by displayable_file_p().
|
static |
sigh...
gcc version
Definition at line 78 of file lowlevel.c.
Referenced by dbll_get_ith_resource_name(), dbll_number_of_resources(), and get_methods().
|
static |
Definition at line 126 of file lowlevel.c.
Referenced by db_get_current_builder_name(), db_reset_current_builder_name(), and db_set_current_builder_name().
const char* dbll_current_module = (const char*) NULL |
the current module is expected by some load/save functions...
Definition at line 41 of file lowlevel.c.
Referenced by dbll_load_resource(), dbll_save_resource(), pipsdbm_read_statement_function(), and pipsdbm_read_statement_mapping().