PIPS
formal_array_resizing_bottom_up.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "effects-util.h"
#include "database.h"
#include "pipsdbm.h"
#include "resources.h"
#include "misc.h"
#include "control.h"
#include "properties.h"
#include "semantics.h"
#include "transformer.h"
#include "pipsmake.h"
#include "abc_private.h"
#include "effects-generic.h"
#include "effects-convex.h"
#include "effects-simple.h"
#include "conversion.h"
#include "text-util.h"
#include "transformations.h"
+ Include dependency graph for formal_array_resizing_bottom_up.c:

Go to the source code of this file.

Macros

#define PREFIX_DEC   "$DEC"
 

Functions

bool formal_array_resizing_bottom_up (char *mod_name)
 This phase do array resizing for unnormalized and formal arguments only. More...
 

Variables

static int number_of_right_array_declarations = 0
 for words_to_string More...
 
static string current_mod =""
 

Macro Definition Documentation

◆ PREFIX_DEC

#define PREFIX_DEC   "$DEC"

Definition at line 65 of file formal_array_resizing_bottom_up.c.

Function Documentation

◆ formal_array_resizing_bottom_up()

bool formal_array_resizing_bottom_up ( char *  mod_name)

This phase do array resizing for unnormalized and formal arguments only.

So we only need SUMMARY_REGIONS

Definition at line 70 of file formal_array_resizing_bottom_up.c.

71 {
73  list l_decl = code_declarations(entity_code(mod_ent)), l_regions = NIL;
74  statement mod_stmt = (statement) db_get_memory_resource(DBR_CODE, mod_name, true);
75  transformer mod_pre;
76  Psysteme pre;
77  current_mod = mod_name;
79  db_get_memory_resource(DBR_PRECONDITIONS,mod_name,true));
81  db_get_memory_resource(DBR_SUMMARY_REGIONS, mod_name, true));
82  regions_init();
83  debug_on("FORMAL_ARRAY_RESIZING_BOTTOM_UP_DEBUG_LEVEL");
84  debug(1," Begin bottom up formal array resizing for %s\n", mod_name);
85  l_regions = load_rw_effects_list(mod_stmt);
86  mod_pre = load_statement_precondition(mod_stmt);
87  pre = predicate_system(transformer_relation(mod_pre));
88  user_log("\n-------------------------------------------------------------------------------------\n");
89  user_log("Prefix \tFile \tModule \tArray \tNdim \tNew declaration\tOld declaration\n");
90  user_log("---------------------------------------------------------------------------------------\n");
91 
92  while (!ENDP(l_decl))
93  {
94  entity e = ENTITY(CAR(l_decl));
95  if (unnormalized_array_p(e))
96  {
97  storage s = entity_storage(e);
98  if (storage_formal_p(s))
99  {
100  region reg = find_union_regions(l_regions,e);
101  new_array_declaration_from_region(reg,e,pre);
102  }
103  }
104  l_decl = CDR(l_decl);
105  }
106  user_log(" \n The total number of right array declarations : %d \n"
108 
109  debug(1,"End bottom up formal array resizing for %s\n", mod_name);
110  debug_off();
111  regions_end();
114  current_mod = "";
115  DB_PUT_MEMORY_RESOURCE(DBR_CODE, mod_name, mod_stmt);
116  return true;
117 }
void user_log(const char *format,...)
Definition: message.c:234
static entity mod_ent
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
#define region
simulation of the type region
void regions_end(void)
void regions_init(void)
void set_rw_effects(statement_effects)
list load_rw_effects_list(statement)
void reset_rw_effects(void)
static int number_of_right_array_declarations
for words_to_string
static string current_mod
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
code entity_code(entity e)
Definition: entity.c:1098
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
bool unnormalized_array_p(entity e)
Definition: entity.c:846
#define storage_formal_p(x)
Definition: ri.h:2522
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define entity_storage(x)
Definition: ri.h:2794
#define code_declarations(x)
Definition: ri.h:784
#define transformer_relation(x)
Definition: ri.h:2873
#define predicate_system(x)
Definition: ri.h:2069
transformer load_statement_precondition(statement)
void reset_precondition_map(void)
void set_precondition_map(statement_mapping)
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References CAR, CDR, code_declarations, current_mod, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug(), debug_off, debug_on, ENDP, ENTITY, entity_code(), entity_storage, load_rw_effects_list(), load_statement_precondition(), mod_ent, module_name_to_entity(), NIL, number_of_right_array_declarations, predicate_system, region, regions_end(), regions_init(), reset_precondition_map(), reset_rw_effects(), set_precondition_map(), set_rw_effects(), storage_formal_p, transformer_relation, unnormalized_array_p(), and user_log().

+ Here is the call graph for this function:

Variable Documentation

◆ current_mod

string current_mod =""
static

Definition at line 63 of file formal_array_resizing_bottom_up.c.

Referenced by formal_array_resizing_bottom_up().

◆ number_of_right_array_declarations

int number_of_right_array_declarations = 0
static

for words_to_string

Definition at line 62 of file formal_array_resizing_bottom_up.c.

Referenced by formal_array_resizing_bottom_up().