PIPS
misc.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "genC.h"
#include "linear.h"
#include "misc.h"
#include "pipsdbm.h"
#include "properties.h"
#include "ri.h"
#include "ri-util.h"
#include "text-util.h"
#include "control.h"
#include "effects.h"
#include "transformer.h"
#include "semantics.h"
#include "effects-generic.h"
+ Include dependency graph for misc.c:

Go to the source code of this file.

Functions

void get_variables_to_remove (list ref_ent, statement s, list *l)
 Modifies the list l so it contains all the loop indexes and scalar written variables It is a little "extension" of the induction variable detection. More...
 

Function Documentation

◆ get_variables_to_remove()

void get_variables_to_remove ( list  ref_ent,
statement  s,
list l 
)

Modifies the list l so it contains all the loop indexes and scalar written variables It is a little "extension" of the induction variable detection.

misc.c

Required by R-Stream. Depending on the activated option, only loop indexes or both loop indexes and written scalar variables are put into the list.

Parameters
ref_entef_ent

Definition at line 58 of file misc.c.

58  {
60  switch(instruction_tag(instTop)) {
62  {
64  FOREACH(statement, stmt, stmts) {
65  list enclosing_loops = load_statement_enclosing_loops(s);
66  if (!ENDP(enclosing_loops) && !statement_loop_p(stmt)) {
67  FOREACH(entity, e, ref_ent) {
68  if (get_bool_property("OUTLINE_REMOVE_VARIABLE_RSTREAM_IMAGE")) {
69  bool write_p = find_write_effect_on_entity(stmt, e);
70  if (index_of_a_loop_p((Variable)e, enclosing_loops) || (write_p && !entity_array_p(e))) {
71  *l = gen_once(e,*l);
72  }
73  }
74  else if (get_bool_property("OUTLINE_REMOVE_VARIABLE_RSTREAM_SCOP")) {
75  if (index_of_a_loop_p((Variable)e, enclosing_loops)) {
76  *l = gen_once(e,*l);
77  }
78  }
79  }
80  }
82  switch(instruction_tag(inst)) {
83  case is_instruction_loop :
85  break;
88  break;
89  case is_instruction_test :
92  break;
93  default :
94  break;
95  }
96 
97  }
98  }
99  break;
100  case is_instruction_loop :
101  {
102  get_variables_to_remove(ref_ent, loop_body(instruction_loop(instTop)), l);
103  }
104  break;
106  {
108  }
109  break;
110  case is_instruction_test :
111  {
112  get_variables_to_remove(ref_ent, test_true(instruction_test(instTop)), l);
113  get_variables_to_remove(ref_ent, test_false(instruction_test(instTop)), l);
114  }
115  break;
116  default :
117  {
118  list enclosing_loops = load_statement_enclosing_loops(s);
119  if (!ENDP(enclosing_loops)) {
120  FOREACH(entity, e, ref_ent) {
121  if (get_bool_property("OUTLINE_REMOVE_VARIABLE_RSTREAM_IMAGE")) {
122  bool write_p = find_write_effect_on_entity(s, e);
123  if (index_of_a_loop_p((Variable)e, enclosing_loops) || (write_p && !entity_array_p(e))) {
124  *l = gen_once(e,*l);
125  }
126  }
127  else if (get_bool_property("OUTLINE_REMOVE_VARIABLE_RSTREAM_SCOP")) {
128  if (index_of_a_loop_p((Variable)e, enclosing_loops)) {
129  *l = gen_once(e,*l);
130  }
131  }
132  }
133  }
134  }
135  break;
136  }
137 }
void get_variables_to_remove(list ref_ent, statement s, list *l)
Modifies the list l so it contains all the loop indexes and scalar written variables It is a little "...
Definition: misc.c:58
bool find_write_effect_on_entity(statement, entity)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
bool index_of_a_loop_p(Variable v, list loops)
Check if variable v is an index for an enclosing loop.
Definition: loop.c:980
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
list gen_once(const void *vo, list l)
Prepend an item to a list only if it is not already in the list.
Definition: list.c:722
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
loop statement_loop(statement)
Get the loop of a statement.
Definition: statement.c:1374
whileloop statement_whileloop(statement)
Get the whileloop of a statement.
Definition: statement.c:1383
bool statement_loop_p(statement)
Definition: statement.c:349
bool entity_array_p(entity e)
Is e a variable with an array type?
Definition: entity.c:754
list load_statement_enclosing_loops(statement)
#define loop_body(x)
Definition: ri.h:1644
#define instruction_loop(x)
Definition: ri.h:1520
#define test_false(x)
Definition: ri.h:2837
@ is_instruction_whileloop
Definition: ri.h:1472
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_sequence
Definition: ri.h:1469
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define test_true(x)
Definition: ri.h:2835
#define sequence_statements(x)
Definition: ri.h:2360
#define instruction_sequence(x)
Definition: ri.h:1514
#define instruction_whileloop(x)
Definition: ri.h:1523
#define whileloop_body(x)
Definition: ri.h:3162
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_test(x)
Definition: ri.h:1517
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
Definition: statement.c:54
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60

References ENDP, entity_array_p(), find_write_effect_on_entity(), FOREACH, gen_once(), get_bool_property(), get_variables_to_remove(), index_of_a_loop_p(), instruction_loop, instruction_sequence, instruction_tag, instruction_test, instruction_whileloop, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_whileloop, load_statement_enclosing_loops(), loop_body, sequence_statements, statement_instruction, statement_loop(), statement_loop_p(), statement_whileloop(), test_false, test_true, and whileloop_body.

Referenced by get_variables_to_remove(), and outliner_parameters().

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