PIPS
+ Collaboration diagram for Control node visitors:

Macros

#define CONTROL_MAP(ctl, code, c, list)
 Macro to walk through all the controls reachable from a given control node of an unstructured. More...
 
#define UNSTRUCTURED_CONTROL_MAP(c, u, l, code)
 Walk through all the controls of un unstructured. More...
 
#define FORWARD_CONTROL_MAP(ctl, code, c, list)
 Walk through all the controls forward-reachable from a given control node of an unstructured. More...
 
#define BACKWARD_CONTROL_MAP(ctl, code, c, list)
 Walk through all the controls backward-reachable from a given control node of an unstructured. More...
 
#define WIDE_FORWARD_CONTROL_MAP(ctl, code, c, list)
 Walk through all the controls backward-reachable from a given control node of an unstructured. More...
 
#define GENERIC_CONTROL_MAP(get_controls, ctl, code, c, list)
 The control node visiting engine. More...
 
#define CONTROL_MAP(ctl, code, c, list)
 Macro to walk through all the controls reachable from a given control node of an unstructured. More...
 
#define UNSTRUCTURED_CONTROL_MAP(c, u, l, code)
 Walk through all the controls of un unstructured. More...
 
#define FORWARD_CONTROL_MAP(ctl, code, c, list)
 Walk through all the controls forward-reachable from a given control node of an unstructured. More...
 
#define BACKWARD_CONTROL_MAP(ctl, code, c, list)
 Walk through all the controls backward-reachable from a given control node of an unstructured. More...
 
#define WIDE_FORWARD_CONTROL_MAP(ctl, code, c, list)
 Walk through all the controls backward-reachable from a given control node of an unstructured. More...
 
#define GENERIC_CONTROL_MAP(get_controls, ctl, code, c, list)
 The control node visiting engine. More...
 

Functions

void control_map_get_blocs (control c, list *l)
 Build recursively the list of all controls reachable from a control of an unstructured. More...
 
void find_a_control_path (control b, control e, list *pp, list *vp, int dir)
 Build recursively a control path from b to e. More...
 
void backward_control_map_get_blocs (c, l)
 Build recursively the list of all controls backward-reachable from a control of an unstructured. More...
 
void backward_control_map_get_blocs_but (control c, control f, list *l)
 Transitive closure of c's predecessors, but for control f. More...
 
void forward_control_map_get_blocs (c, l)
 Build recursively the list of all controls forward-reachable from a control of an unstructured. More...
 
void forward_control_map_get_blocs_but (control c, control f, list *l)
 Transitive closure of c's successors, but for control f. More...
 
void wide_forward_control_map_get_blocs (c, l)
 Same as above, but follows successors by minimal path lengths. More...
 

Detailed Description

Macro Definition Documentation

◆ BACKWARD_CONTROL_MAP [1/2]

#define BACKWARD_CONTROL_MAP (   ctl,
  code,
  c,
  list 
)
Value:
do { \
GENERIC_CONTROL_MAP( backward_control_map_get_blocs, ctl, code, c, list ) \
} while(0)
void backward_control_map_get_blocs(c, l)
Build recursively the list of all controls backward-reachable from a control of an unstructured.
Definition: control.c:157
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

Walk through all the controls backward-reachable from a given control node of an unstructured.

Reachability is defined by predecessor-only relation (i.e. the control flow graph is seen as directed)

Parameters
ctlis a name of a control node variable that is declared inside this macro and is used by the following code to access the visited control node
codeis the actions to execute on the visited control node
cis a control node to start visiting with
listis a list that will store the visited control nodes. It is used mainly for this macro to avoid visiting twice a node. The simple usage is to give a list variable initialized to NIL. A nice side effect is that it will contain the list of all the backward-reachable control nodes. Do not forget to free this list afterwards. Another classical usage is to give to the macro a list with a list of nodes to avoid visiting.

Definition at line 2167 of file ri-util-local.h.

◆ BACKWARD_CONTROL_MAP [2/2]

#define BACKWARD_CONTROL_MAP (   ctl,
  code,
  c,
  list 
)
Value:
do { \
GENERIC_CONTROL_MAP( backward_control_map_get_blocs, ctl, code, c, list ) \
} while(0)
void backward_control_map_get_blocs(control, cons **)

Walk through all the controls backward-reachable from a given control node of an unstructured.

Reachability is defined by predecessor-only relation (i.e. the control flow graph is seen as directed)

Parameters
ctlis a name of a control node variable that is declared inside this macro and is used by the following code to access the visited control node
codeis the actions to execute on the visited control node
cis a control node to start visiting with
listis a list that will store the visited control nodes. It is used mainly for this macro to avoid visiting twice a node. The simple usage is to give a list variable initialized to NIL. A nice side effect is that it will contain the list of all the backward-reachable control nodes. Do not forget to free this list afterwards. Another classical usage is to give to the macro a list with a list of nodes to avoid visiting.

Definition at line 2175 of file ri-util.h.

◆ CONTROL_MAP [1/2]

#define CONTROL_MAP (   ctl,
  code,
  c,
  list 
)
Value:
do { \
GENERIC_CONTROL_MAP( control_map_get_blocs, ctl, code, c, list ) \
} while(0)
void control_map_get_blocs(control c, list *l)
Build recursively the list of all controls reachable from a control of an unstructured.
Definition: control.c:75

Macro to walk through all the controls reachable from a given control node of an unstructured.

Reachability is defined by successors and predecessors (i.e. the control flow graph is seen as non-directed)

Parameters
ctlis a name of a control node variable that is declared inside this macro and is used by the following code to access the visited control node
codeis the actions to execute on the visited control node
cis a control node to start visiting with
listis a list that will store the visited control nodes. It is used mainly for this macro to avoid visiting twice a node. The simple usage is to give a list variable initialized to NIL. A nice side effect is that it will contain the list of all the reachable control nodes. Do not forget to free this list afterwards. Another classical usage is to give to the macro a list with a list of nodes to avoid visiting.

Definition at line 2071 of file ri-util-local.h.

◆ CONTROL_MAP [2/2]

#define CONTROL_MAP (   ctl,
  code,
  c,
  list 
)
Value:
do { \
GENERIC_CONTROL_MAP( control_map_get_blocs, ctl, code, c, list ) \
} while(0)

Macro to walk through all the controls reachable from a given control node of an unstructured.

Reachability is defined by successors and predecessors (i.e. the control flow graph is seen as non-directed)

Parameters
ctlis a name of a control node variable that is declared inside this macro and is used by the following code to access the visited control node
codeis the actions to execute on the visited control node
cis a control node to start visiting with
listis a list that will store the visited control nodes. It is used mainly for this macro to avoid visiting twice a node. The simple usage is to give a list variable initialized to NIL. A nice side effect is that it will contain the list of all the reachable control nodes. Do not forget to free this list afterwards. Another classical usage is to give to the macro a list with a list of nodes to avoid visiting.

Definition at line 2079 of file ri-util.h.

◆ FORWARD_CONTROL_MAP [1/2]

#define FORWARD_CONTROL_MAP (   ctl,
  code,
  c,
  list 
)
Value:
do { \
GENERIC_CONTROL_MAP( forward_control_map_get_blocs, ctl, code, c, list ) \
} while(0)
void forward_control_map_get_blocs(c, l)
Build recursively the list of all controls forward-reachable from a control of an unstructured.
Definition: control.c:208

Walk through all the controls forward-reachable from a given control node of an unstructured.

Reachability is defined by successor-only relation (i.e. the control flow graph is seen as directed)

Parameters
ctlis a name of a control node variable that is declared inside this macro and is used by the following code to access the visited control node
codeis the actions to execute on the visited control node
cis a control node to start visiting with
listis a list that will store the visited control nodes. It is used mainly for this macro to avoid visiting twice a node. The simple usage is to give a list variable initialized to NIL. A nice side effect is that it will contain the list of all the forward-reachable control nodes. Do not forget to free this list afterwards. Another classical usage is to give to the macro a list with a list of nodes to avoid visiting.

Definition at line 2139 of file ri-util-local.h.

◆ FORWARD_CONTROL_MAP [2/2]

#define FORWARD_CONTROL_MAP (   ctl,
  code,
  c,
  list 
)
Value:
do { \
GENERIC_CONTROL_MAP( forward_control_map_get_blocs, ctl, code, c, list ) \
} while(0)
void forward_control_map_get_blocs(control, cons **)

Walk through all the controls forward-reachable from a given control node of an unstructured.

Reachability is defined by successor-only relation (i.e. the control flow graph is seen as directed)

Parameters
ctlis a name of a control node variable that is declared inside this macro and is used by the following code to access the visited control node
codeis the actions to execute on the visited control node
cis a control node to start visiting with
listis a list that will store the visited control nodes. It is used mainly for this macro to avoid visiting twice a node. The simple usage is to give a list variable initialized to NIL. A nice side effect is that it will contain the list of all the forward-reachable control nodes. Do not forget to free this list afterwards. Another classical usage is to give to the macro a list with a list of nodes to avoid visiting.

Definition at line 2147 of file ri-util.h.

◆ GENERIC_CONTROL_MAP [1/2]

#define GENERIC_CONTROL_MAP (   get_controls,
  ctl,
  code,
  c,
  list 
)
Value:
{ \
cons *_cm_list_init = (list) ; \
cons *_cm_list = _cm_list_init ; \
if( _cm_list == NIL ) {\
get_controls( c, &_cm_list ) ; \
_cm_list = gen_nreverse( _cm_list ) ; \
}\
MAPL( _cm_ctls, {control ctl = CONTROL( CAR( _cm_ctls )) ; \
\
code ;}, \
_cm_list ) ; \
if( _cm_list_init == NIL ) \
list = _cm_list ; \
}
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#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
struct cons * list
Definition: newgen_types.h:106
#define CONTROL(x)
CONTROL.
Definition: ri.h:910

The control node visiting engine.

Definition at line 2202 of file ri-util-local.h.

◆ GENERIC_CONTROL_MAP [2/2]

#define GENERIC_CONTROL_MAP (   get_controls,
  ctl,
  code,
  c,
  list 
)
Value:
{ \
cons *_cm_list_init = (list) ; \
cons *_cm_list = _cm_list_init ; \
if( _cm_list == NIL ) {\
get_controls( c, &_cm_list ) ; \
_cm_list = gen_nreverse( _cm_list ) ; \
}\
MAPL( _cm_ctls, {control ctl = CONTROL( CAR( _cm_ctls )) ; \
\
code ;}, \
_cm_list ) ; \
if( _cm_list_init == NIL ) \
list = _cm_list ; \
}

The control node visiting engine.

Definition at line 2210 of file ri-util.h.

◆ UNSTRUCTURED_CONTROL_MAP [1/2]

#define UNSTRUCTURED_CONTROL_MAP (   c,
  u,
  l,
  code 
)
Value:
/**The implementation is sub-optimal because it duplicates the \
code... */ \
do { \
/**First get the control nodes reachable from the entry node: */ \
control_map_get_blocs(unstructured_entry(u), &l); \
/**Add then the control nodes reachable from the exit nodes if not \
already in: */ \
control_map_get_blocs(unstructured_exit(u), &l); \
/**Reverse the list because previous construction was done in the \
reverse way: */ \
l = gen_nreverse(l); \
/**Iterate on all the selected control nodes: */ \
FOREACH(CONTROL, c, l) \
code \
} while(0)
#define unstructured_exit(x)
Definition: ri.h:3006
#define unstructured_entry(x)
Definition: ri.h:3004

Walk through all the controls of un unstructured.

This macro do not work indeed because often the...

The nodes are those reachable from the entry node and also from the exit node (that may be unreachable from the entry node of th unstructured).

Reachability is defined by successors and predecessors (i.e. the control flow graph is seen as non-directed)

Parameters
cis a name of a control node variable that is declared inside this macro and is used by the following code to access the visited control node
codeis the actions to execute on the visited control node
uis the unstructured to visit
lis a list that will store the visited control nodes. It is used mainly for this macro to avoid visiting twice a node. The simple usage is to give a list variable initialized to NIL. A nice side effect is that it will contain the list of all the reachable control nodes. Do not forget to free this list afterwards. Another classical usage is to give to the macro a list with a list of nodes to avoid visiting.

Definition at line 2102 of file ri-util-local.h.

◆ UNSTRUCTURED_CONTROL_MAP [2/2]

#define UNSTRUCTURED_CONTROL_MAP (   c,
  u,
  l,
  code 
)
Value:
/**The implementation is sub-optimal because it duplicates the \
code... */ \
do { \
/**First get the control nodes reachable from the entry node: */ \
control_map_get_blocs(unstructured_entry(u), &l); \
/**Add then the control nodes reachable from the exit nodes if not \
already in: */ \
control_map_get_blocs(unstructured_exit(u), &l); \
/**Reverse the list because previous construction was done in the \
reverse way: */ \
l = gen_nreverse(l); \
/**Iterate on all the selected control nodes: */ \
FOREACH(CONTROL, c, l) \
code \
} while(0)

Walk through all the controls of un unstructured.

This macro do not work indeed because often the...

The nodes are those reachable from the entry node and also from the exit node (that may be unreachable from the entry node of th unstructured).

Reachability is defined by successors and predecessors (i.e. the control flow graph is seen as non-directed)

Parameters
cis a name of a control node variable that is declared inside this macro and is used by the following code to access the visited control node
codeis the actions to execute on the visited control node
uis the unstructured to visit
lis a list that will store the visited control nodes. It is used mainly for this macro to avoid visiting twice a node. The simple usage is to give a list variable initialized to NIL. A nice side effect is that it will contain the list of all the reachable control nodes. Do not forget to free this list afterwards. Another classical usage is to give to the macro a list with a list of nodes to avoid visiting.

Definition at line 2110 of file ri-util.h.

◆ WIDE_FORWARD_CONTROL_MAP [1/2]

#define WIDE_FORWARD_CONTROL_MAP (   ctl,
  code,
  c,
  list 
)
Value:
do { \
GENERIC_CONTROL_MAP(wide_forward_control_map_get_blocs, \
ctl, code, c, list ) \
} while(0)
void wide_forward_control_map_get_blocs(c, l)
Same as above, but follows successors by minimal path lengths.
Definition: control.c:252

Walk through all the controls backward-reachable from a given control node of an unstructured.

Reachability is defined by successor-only relation (i.e. the control flow graph is seen as directed)

Parameters
ctlis a name of a control node variable that is declared inside this macro and is used by the following code to access the visited control node
codeis the actions to execute on the visited control node
cis a control node to start visiting with
listis a list that will store the visited control nodes. It is used mainly for this macro to avoid visiting twice a node. The simple usage is to give a list variable initialized to NIL. A nice side effect is that it will contain the list of all the reachable control nodes. Do not forget to free this list afterwards. Another classical usage is to give to the macro a list with a list of nodes to avoid visiting.

Definition at line 2194 of file ri-util-local.h.

◆ WIDE_FORWARD_CONTROL_MAP [2/2]

#define WIDE_FORWARD_CONTROL_MAP (   ctl,
  code,
  c,
  list 
)
Value:
do { \
GENERIC_CONTROL_MAP(wide_forward_control_map_get_blocs, \
ctl, code, c, list ) \
} while(0)
void wide_forward_control_map_get_blocs(control, cons **)

Walk through all the controls backward-reachable from a given control node of an unstructured.

Reachability is defined by successor-only relation (i.e. the control flow graph is seen as directed)

Parameters
ctlis a name of a control node variable that is declared inside this macro and is used by the following code to access the visited control node
codeis the actions to execute on the visited control node
cis a control node to start visiting with
listis a list that will store the visited control nodes. It is used mainly for this macro to avoid visiting twice a node. The simple usage is to give a list variable initialized to NIL. A nice side effect is that it will contain the list of all the reachable control nodes. Do not forget to free this list afterwards. Another classical usage is to give to the macro a list with a list of nodes to avoid visiting.

Definition at line 2202 of file ri-util.h.

Function Documentation

◆ backward_control_map_get_blocs()

void backward_control_map_get_blocs ( ,
 
)

Build recursively the list of all controls backward-reachable from a control of an unstructured.

It is usually called from the BACKWARD_CONTROL_MAP macro, with the entry node of an unstructured as initial argument. It uses predecessors to define reachability.

Parameters
cis a control node to start with
lis a list used to stored the visited nodes. It must be initialized to the list of nodes to skip. To visit all the nodes from c, just give a list variable initialized to NIL

Definition at line 157 of file control.c.

160 {
161  MAPL( cs, {if( CONTROL( CAR( cs )) == c ) return ;}, *l ) ;
162  *l = CONS( CONTROL, c, *l ) ;
163  MAPL( cs,
164  {backward_control_map_get_blocs( CONTROL( CAR( cs )), l );},
165  control_predecessors( c )) ;
166 }
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
Definition: newgen_list.h:203
#define control_predecessors(x)
Definition: ri.h:943

References CAR, CONS, CONTROL, control_predecessors, and MAPL.

◆ backward_control_map_get_blocs_but()

void backward_control_map_get_blocs_but ( control  c,
control  f,
list l 
)

Transitive closure of c's predecessors, but for control f.

It is like backward_control_map_get_blocs() but avoid visiting a control node. It is used to visit subgraphs begining at c and ending at f (excluded).

Parameters
cis a control node to start with
fis a control node not to visit
lis a list used to stored the visited nodes. It must be initialized to the list of nodes to skip. To visit all the nodes from c, just give a list variable initialized to NIL

Definition at line 184 of file control.c.

185 {
186  if(gen_in_list_p(c, *l) || c == f) return;
187  *l = CONS( CONTROL, c, *l ) ;
188  MAPL( cs, {
190  }, control_predecessors( c )) ;
191 }
void backward_control_map_get_blocs_but(control c, control f, list *l)
Transitive closure of c's predecessors, but for control f.
Definition: control.c:184
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
Definition: list.c:734
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15

References CAR, CONS, CONTROL, control_predecessors, f(), gen_in_list_p(), and MAPL.

+ Here is the call graph for this function:

◆ control_map_get_blocs()

void control_map_get_blocs ( control  c,
list l 
)

Build recursively the list of all controls reachable from a control of an unstructured.

It is usually called from the CONTROL_MAP macro, with the entry node of an unstructured as initial argument. It uses both successors and predecessors to define reachability, i.e. the graph arcs are considered edges.

Parameters
cis a control node to start with
lis a list used to stored the visited nodes. It must be initialized to the list of nodes to skip. To visit all the nodes from c, just give a list variable initialized to NIL

Definition at line 75 of file control.c.

76 {
77  MAPL( cs,
78  {if( CONTROL( CAR( cs )) == c ) return ;},
79  *l ) ;
80  *l = CONS( CONTROL, c, *l ) ;
81  MAPL( cs,
82  {control_map_get_blocs( CONTROL( CAR( cs )), l );},
83  control_successors( c )) ;
84  MAPL( ps, {control_map_get_blocs( CONTROL( CAR( ps )), l );},
85  control_predecessors( c )) ;
86 }
#define control_successors(x)
Definition: ri.h:945

References CAR, CONS, CONTROL, control_predecessors, control_successors, and MAPL.

Referenced by controlize_sequence(), dag_or_cycle_to_flow_sensitive_postconditions_or_transformers(), dag_to_flow_sensitive_preconditions(), loop_normalize_of_unstructured(), static_controlize_unstructured(), and stco_renumber_code().

+ Here is the caller graph for this function:

◆ find_a_control_path()

void find_a_control_path ( control  b,
control  e,
list pp,
list vp,
int  dir 
)

Build recursively a control path from b to e.

It is used for debugging purposes

Parameters
bis a control node to begin with
eis a control node to end with
ppis a pointer to the list used to stored the path from b to e. It includes both b and e.
vpis a pointer to the list used to stored the visited nodes. It must be initialized to the list of nodes to skip if any. To visit all the nodes from c, just give a list variable initialized to NIL. It usually must be by the caller.
dirrequest a forward path is strictly positive, a backward path is stricly negative and an undirected path if zero.
Parameters
ppp
vpp
dirir

Definition at line 107 of file control.c.

108 {
109  if(b==e) {
110  *pp = CONS(CONTROL, b, NIL);
111  return;
112  }
113 
114  if(ENDP(*pp) && !gen_in_list_p(b, *vp)) {
115  *vp = CONS(CONTROL, b, *vp);
116  if(dir>=0) {
118  find_a_control_path(s, e, pp, vp, dir);
119  if(!ENDP(*pp)) {
120  pips_assert("e is the last element of *pp",
121  e==CONTROL(CAR(gen_last(*pp))));
122  *pp = CONS(CONTROL, s, *pp);
123  return;
124  }
125  }
126  }
127  if(dir<=0) {
129  find_a_control_path(p, e, pp, vp, dir);
130  if(!ENDP(*pp)) {
131  pips_assert("e is the last element of *pp",
132  e==CONTROL(CAR(gen_last(*pp))));
133  *pp = CONS(CONTROL, p, *pp);
134  return;
135  }
136  }
137  }
138  }
139  pips_assert("*pp is empty", ENDP(*pp));
140  return;
141 }
void find_a_control_path(control b, control e, list *pp, list *vp, int dir)
Build recursively a control path from b to e.
Definition: control.c:107
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
list gen_last(list l)
Return the last element of a list.
Definition: list.c:578
#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
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172

References CAR, CONS, CONTROL, control_predecessors, control_successors, ENDP, FOREACH, gen_in_list_p(), gen_last(), NIL, and pips_assert.

Referenced by controlize_sequence().

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

◆ forward_control_map_get_blocs()

void forward_control_map_get_blocs ( ,
 
)

Build recursively the list of all controls forward-reachable from a control of an unstructured.

It is usually called from the FORWARD_CONTROL_MAP macro, with the entry node of an unstructured as initial argument. It uses successors to define reachability.

Parameters
cis a control node to start with
lis a list used to stored the visited nodes. It must be initialized to the list of nodes to skip. To visit all the nodes from c, just give a list variable initialized to NIL

Definition at line 208 of file control.c.

211 {
212  MAPL( cs, {if( CONTROL( CAR( cs )) == c ) return ;}, *l ) ;
213  *l = CONS( CONTROL, c, *l ) ;
214  MAPL( cs,
215  {forward_control_map_get_blocs( CONTROL( CAR( cs )), l );},
216  control_successors( c )) ;
217 }

References CAR, CONS, CONTROL, control_successors, and MAPL.

Referenced by cycle_to_flow_sensitive_preconditions(), dag_or_cycle_to_flow_sensitive_postconditions_or_transformers(), davinci_print_non_deterministic_unstructured(), unstructured_consistency_p(), unstructured_to_flow_sensitive_postconditions(), unstructured_to_transformer(), and unstructured_while_p().

+ Here is the caller graph for this function:

◆ forward_control_map_get_blocs_but()

void forward_control_map_get_blocs_but ( control  c,
control  f,
list l 
)

Transitive closure of c's successors, but for control f.

It is like forward_control_map_get_blocs() but avoid visiting a control node. It is used to visit subgraphs begining at c and ending at f (excluded).

Parameters
cis a control node to start with
fis a control node not to visit
lis a list used to stored the visited nodes. It must be initialized to the list of nodes to skip. To visit all the nodes from c, just give a list variable initialized to NIL

Definition at line 234 of file control.c.

235 {
236  if(gen_in_list_p(c, *l) || c == f) return;
237  *l = CONS( CONTROL, c, *l ) ;
238  MAPL( cs, {
240  }, control_successors( c )) ;
241 }
void forward_control_map_get_blocs_but(control c, control f, list *l)
Transitive closure of c's successors, but for control f.
Definition: control.c:234

References CAR, CONS, CONTROL, control_successors, f(), gen_in_list_p(), and MAPL.

+ Here is the call graph for this function:

◆ wide_forward_control_map_get_blocs()

void wide_forward_control_map_get_blocs ( ,
 
)

Same as above, but follows successors by minimal path lengths.

It is OK if there is only one path length when computing transformers and/or preconditions. However, if a node is reached by several paths, the node with the minimal maximal path length should come first.

This last condition assumes infinite path length for nodes in cycles (?). It is not implemented.

Definition at line 252 of file control.c.

255 {
256  list nodes = NIL;
257  list frontier = CONS( CONTROL, c, NIL );
258  list new_frontier = NIL;
259 
260  while(!ENDP(frontier)) {
261  MAP(CONTROL,c ,{
262  MAP(CONTROL, cp, {
263  if(!is_control_in_list_p(cp, nodes)
264  && !is_control_in_list_p(cp, frontier)
265  && !is_control_in_list_p(cp, new_frontier))
266  new_frontier = CONS(CONTROL, cp, new_frontier);
267  }, control_successors(c));
268  }, frontier);
269  nodes = gen_append(nodes, frontier);
270  frontier = new_frontier;
271  new_frontier = NIL;
272  }
273 
274  *l = nodes;
275 }
bool is_control_in_list_p(control c, list cs)
Test if a control node is in a list of control nodes.
Definition: control.c:299
list gen_append(list l1, const list l2)
Definition: list.c:471
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226
Pvecteur cp
pointeur sur l'egalite ou l'inegalite courante
Definition: sc_read.c:87

References CONS, CONTROL, control_successors, cp, ENDP, gen_append(), is_control_in_list_p(), MAP, and NIL.

+ Here is the call graph for this function: