PIPS
ordering.c File Reference

Defines a static mapping from orderings to statements. More...

#include <stdio.h>
#include "linear.h"
#include "genC.h"
#include "ri.h"
#include "misc.h"
#include "ri-util.h"
+ Include dependency graph for ordering.c:

Go to the source code of this file.

Functions

bool ordering_to_statement_initialized_p ()
 Test if the ordering to statement is initialized. More...
 
void print_ordering_to_statement (void)
 Dump the ordering with the corresponding statement address. More...
 
static statement apply_ordering_to_statement (hash_table ots, _int o)
 Get the statement from an ordering in a given ordering to statement table. More...
 
statement ordering_to_statement (int o)
 Get the statement associated to a given ordering. More...
 
static bool add_ordering_of_the_statement (statement stat, hash_table ots)
 Add the statement for its ordering, if any, in the hash-map. More...
 
bool add_ordering_of_the_statement_to_current_mapping (statement stat)
 Add the statement for its ordering, if any, in the hash-map. More...
 
bool overwrite_ordering_of_the_statement_to_current_mapping (statement stat)
 Overwrite the statement for its ordering, if any, in the hash-map. More...
 
static void rinitialize_ordering_to_statement (hash_table ots, statement s)
 Initialize the ordering to statement mapping by iterating from a given statement. More...
 
hash_table set_ordering_to_statement (statement s)
 To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in sync with the current module. More...
 
void reset_ordering_to_statement (void)
 Reset the mapping from ordering to statement. More...
 

Variables

static hash_table OrderingToStatement = hash_table_undefined
 a hash table to map orderings (integer) to statements (pointers) assumed to be valid for the current module returned by get_current_module_entity(). More...
 

Detailed Description

Defines a static mapping from orderings to statements.

must be initialize_ordering_to_statement, and afterwards reset_ordering_to_statement.

For information on ordering, see control/reorder.c

Definition in file ordering.c.

Function Documentation

◆ add_ordering_of_the_statement()

static bool add_ordering_of_the_statement ( statement  stat,
hash_table  ots 
)
static

Add the statement for its ordering, if any, in the hash-map.

Definition at line 120 of file ordering.c.

121 {
122  pips_assert("ordering is defined",
124  hash_put(ots, (void *) statement_ordering(stat), (void *) stat);
125  return true;
126 }
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
Definition: newgen-local.h:35
#define statement_ordering(x)
Definition: ri.h:2454

References hash_put(), pips_assert, statement_ordering, and STATEMENT_ORDERING_UNDEFINED.

Referenced by rinitialize_ordering_to_statement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_ordering_of_the_statement_to_current_mapping()

bool add_ordering_of_the_statement_to_current_mapping ( statement  stat)

Add the statement for its ordering, if any, in the hash-map.

Parameters
stattat

Definition at line 130 of file ordering.c.

131 {
132  pips_assert("ordering is defined",
134  hash_put(OrderingToStatement, (void *) statement_ordering(stat), (void *) stat);
135  return true;
136 }
static hash_table OrderingToStatement
a hash table to map orderings (integer) to statements (pointers) assumed to be valid for the current ...
Definition: ordering.c:58

References hash_put(), OrderingToStatement, pips_assert, statement_ordering, and STATEMENT_ORDERING_UNDEFINED.

+ Here is the call graph for this function:

◆ apply_ordering_to_statement()

static statement apply_ordering_to_statement ( hash_table  ots,
_int  o 
)
static

Get the statement from an ordering in a given ordering to statement table.

Definition at line 87 of file ordering.c.

88 {
89  statement s;
90  pips_assert("defined hash table...",
91  ots != NULL && ots != hash_table_undefined);
92 
94  pips_internal_error("Illegal ordering %td", o);
95 
96  s = (statement) hash_get(ots, (char *) o);
97 
98  if(s == statement_undefined)
99  pips_internal_error("no statement for order %td=(%td,%td)",
101 
102  return s;
103 }
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:449
#define pips_internal_error
Definition: misc-local.h:149
#define hash_table_undefined
Value of an undefined hash_table.
Definition: newgen_hash.h:49
#define ORDERING_NUMBER(o)
#define ORDERING_STATEMENT(o)
#define statement_undefined
Definition: ri.h:2419

References hash_get(), hash_table_undefined, ORDERING_NUMBER, ORDERING_STATEMENT, pips_assert, pips_internal_error, STATEMENT_ORDERING_UNDEFINED, and statement_undefined.

Referenced by ordering_to_statement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ordering_to_statement()

statement ordering_to_statement ( int  o)

Get the statement associated to a given ordering.

It is useful for retrieve the statements associated with the arcs in the dependence graphs for example.

Definition at line 111 of file ordering.c.

112 {
113  statement s;
115  return s;
116 }
static statement apply_ordering_to_statement(hash_table ots, _int o)
Get the statement from an ordering in a given ordering to statement table.
Definition: ordering.c:87

References apply_ordering_to_statement(), and OrderingToStatement.

Referenced by adg_number_to_statement(), adg_only_call_WR_dependence(), adg_reorder_statement_number(), adg_vertex_to_statement(), AK_ignore_this_vertex(), guard_elimination(), imprime_quast(), LowlinkCompute(), pipsdbm_read_statement_function(), pipsdbm_read_statement_mapping(), process_reduced_loops(), and vertex_to_statement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ordering_to_statement_initialized_p()

bool ordering_to_statement_initialized_p ( void  )

Test if the ordering to statement is initialized.

ordering.c

Definition at line 63 of file ordering.c.

64 {
66 }

References hash_table_undefined, and OrderingToStatement.

Referenced by module_body_reorder(), module_reorder(), and step_parser().

+ Here is the caller graph for this function:

◆ overwrite_ordering_of_the_statement_to_current_mapping()

bool overwrite_ordering_of_the_statement_to_current_mapping ( statement  stat)

Overwrite the statement for its ordering, if any, in the hash-map.

The difference with add_ordering_of_the_statement_to_current_mapping() is that this version won't trigger a warning if the mapping already exist

Parameters
stattat

Definition at line 142 of file ordering.c.

143 {
144  pips_assert("ordering is defined",
146  hash_overwrite(OrderingToStatement, (void *) statement_ordering(stat), (void *) stat);
147  return true;
148 }
void hash_overwrite(hash_table htp, const void *key, const void *val)
hash_put which allows silent overwrite...
Definition: hash.c:344

References hash_overwrite(), OrderingToStatement, pips_assert, statement_ordering, and STATEMENT_ORDERING_UNDEFINED.

+ Here is the call graph for this function:

◆ print_ordering_to_statement()

void print_ordering_to_statement ( void  )

Dump the ordering with the corresponding statement address.

Definition at line 71 of file ordering.c.

72 {
73  HASH_MAP(ko, vs, {
74  _int o = (_int) ko;
75  statement s = (statement) vs;
76 
77  fprintf(stderr,"%td (%td,%td)->%s\n",
81 }
string statement_identification(statement)
Like external_statement_identification(), but with internal information, the hexadecimal address of t...
Definition: statement.c:1700
#define HASH_MAP(k, v, code, ht)
Definition: newgen_hash.h:60
intptr_t _int
_INT
Definition: newgen_types.h:53
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References fprintf(), HASH_MAP, ORDERING_NUMBER, ORDERING_STATEMENT, OrderingToStatement, and statement_identification().

Referenced by prettyprint_dependence_graph(), prettyprint_dot_dependence_graph(), and xml_Chain_Graph().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset_ordering_to_statement()

void reset_ordering_to_statement ( void  )

Reset the mapping from ordering to statement.

Definition at line 185 of file ordering.c.

186 {
187  pips_assert("hash table is defined",
189 
192 }
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
Definition: hash.c:327

References hash_table_free(), hash_table_undefined, OrderingToStatement, and pips_assert.

Referenced by add_aliases_for_current_caller(), alias_check(), array_bound_check_bottom_up(), array_bound_check_interprocedural(), array_bound_check_top_down(), bdsc_code_instrumentation(), chains(), copy_value_of_write(), copy_value_of_write_with_cumulated_regions(), deatomizer(), delay_communications(), delay_load_communications(), delay_store_communications(), do_it(), dsc_code_parallelization(), eliminate_original_variables(), flinter(), forward_substitute(), hbdsc_parallelization(), if_conversion_compact(), impact_check(), invariant_code_motion(), module_reorder(), mpi_conversion(), mpi_task_generation(), old_array_bound_check_instrumentation(), openmp_task_generation(), parallel_tiling(), pipsdbm_read_statement_function(), pipsdbm_read_statement_mapping(), print_dependence_or_chains_graph(), print_dot_dependence_or_chains_graph(), print_filtered_dg_or_dvdg(), print_loopnest_dependence_cone(), process_reduced_loops(), reduction_detection(), reduction_propagation(), redundant_load_store_elimination(), regions_to_loops(), rice_dependence_graph(), scalar_renaming(), sequence_dependence_graph(), simdizer(), spire_distributed_unstructured_to_structured(), spire_shared_unstructured_to_structured(), step_analyse(), step_parser(), used_before_set(), variable_replication(), wp65(), and xml_Chains().

+ Here is the call graph for this function:

◆ rinitialize_ordering_to_statement()

static void rinitialize_ordering_to_statement ( hash_table  ots,
statement  s 
)
static

Initialize the ordering to statement mapping by iterating from a given statement.

Parameters
otsis ordering to statement hash-table to fill
sis the statement to start with. Typically the module statement.

Simplify this with a gen_recurse to avoid dealing with all the new cases by hand (for-loops...).

Apply a prefix hash-map add to be compatible with previous implementation and avoid different hash-map iteration later.

Definition at line 159 of file ordering.c.

160 {
161  /* Simplify this with a gen_recurse to avoid dealing with all the new
162  cases by hand (for-loops...).
163 
164  Apply a prefix hash-map add to be compatible with previous
165  implementation and avoid different hash-map iteration later. */
167 }
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
Definition: genC.h:285
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
Definition: genClib.c:2758
static bool add_ordering_of_the_statement(statement stat, hash_table ots)
Add the statement for its ordering, if any, in the hash-map.
Definition: ordering.c:120
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362

References add_ordering_of_the_statement(), gen_context_recurse, gen_null2(), and statement_domain.

Referenced by set_ordering_to_statement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_ordering_to_statement()

hash_table set_ordering_to_statement ( statement  s)

To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in sync with the current module.

Definition at line 172 of file ordering.c.

173 {
174  pips_assert("hash table \"OrderingToStatement\" is undefined",
178  OrderingToStatement = ots;
179  return ots;
180 }
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
@ hash_int
Definition: newgen_hash.h:32
static void rinitialize_ordering_to_statement(hash_table ots, statement s)
Initialize the ordering to statement mapping by iterating from a given statement.
Definition: ordering.c:159

References hash_int, hash_table_make(), hash_table_undefined, OrderingToStatement, pips_assert, and rinitialize_ordering_to_statement().

Referenced by add_aliases_for_current_caller(), alias_check(), array_bound_check_bottom_up(), array_bound_check_interprocedural(), array_bound_check_top_down(), bdsc_code_instrumentation(), chains(), copy_value_of_write(), copy_value_of_write_with_cumulated_regions(), deatomizer(), delay_communications(), delay_load_communications(), delay_store_communications(), do_it(), dsc_code_parallelization(), eliminate_original_variables(), flinter(), forward_substitute(), hbdsc_parallelization(), if_conversion_compact(), impact_check(), invariant_code_motion(), module_reorder(), mpi_conversion(), mpi_task_generation(), old_array_bound_check_instrumentation(), openmp_task_generation(), parallel_tiling(), pipsdbm_read_statement_function(), pipsdbm_read_statement_mapping(), print_dependence_or_chains_graph(), print_dot_dependence_or_chains_graph(), print_filtered_dg_or_dvdg(), print_loopnest_dependence_cone(), process_reduced_loops(), reduction_detection(), reduction_propagation(), redundant_load_store_elimination(), regions_to_loops(), rice_dependence_graph(), scalar_renaming(), sequence_dependence_graph(), simdizer(), spire_distributed_unstructured_to_structured(), spire_shared_unstructured_to_structured(), step_analyse(), used_before_set(), variable_replication(), wp65(), and xml_Chains().

+ Here is the call graph for this function:

Variable Documentation

◆ OrderingToStatement

hash_table OrderingToStatement = hash_table_undefined
static

a hash table to map orderings (integer) to statements (pointers) assumed to be valid for the current module returned by get_current_module_entity().

This is assumed to hold when pipsmake issues a request to lower level libraries.

db_get_current_module() returns the module used in the request to pipsmake and is usually different.

It would be possible to expose a lower level interface to manage several ordering_to_statement hash tables

Definition at line 58 of file ordering.c.

Referenced by add_ordering_of_the_statement_to_current_mapping(), ordering_to_statement(), ordering_to_statement_initialized_p(), overwrite_ordering_of_the_statement_to_current_mapping(), print_ordering_to_statement(), reset_ordering_to_statement(), and set_ordering_to_statement().