@@ -19,6 +19,13 @@ proces of "irept" hierarchical and shared data structures.
19
19
#include < util/irep.h>
20
20
#include < functional>
21
21
22
+ // / An instrumenter is any function returning from a passed instance of
23
+ // / 'irept' its instrumented version. If the passed instance does not
24
+ // / match the king of 'irept' to be instrumented, the function must return
25
+ // / the same instance to indicate no instrumentation was performed.
26
+ // / Due to performance reasons it is recomended to write instrumenter
27
+ // / functions looking only into the passed instance (i.e. not into
28
+ // / 'irept' hierarchy below the passed instance).
22
29
typedef std::function<irept(irept)> instrumenter_fnt;
23
30
typedef std::function<irept(irept, irept)> pivot_instrumenter_fnt;
24
31
@@ -31,6 +38,17 @@ typedef std::function<irept(irept, irept)> pivot_instrumenter_fnt;
31
38
Outputs:
32
39
33
40
Purpose:
41
+ The function accepts a hierarchy of 'irept's and for each node in
42
+ the hierarchy it calls the passed instrumenter. The result of the
43
+ function is a new 'irept' hierarchy constructed from the original
44
+ one by traversing it bottom-up and by applying the instrumenter on
45
+ each visited node. It is possible that in the end the new hierarchy
46
+ shares some nodes with the original hierarchy. Namely, a node in the
47
+ new hierarchy is NOT a node of the original hierarchy only if
48
+ (a) The instrumenter returned for that node a new (different) node,
49
+ (b) The instrumenter returned for that node the same node, but in the
50
+ sub-hierarchy under that node there is a node for which the case (a)
51
+ was applied.
34
52
35
53
\*******************************************************************/
36
54
irept instrument (const irept irep, const instrumenter_fnt &instrumenter);
@@ -44,6 +62,17 @@ irept instrument(const irept irep, const instrumenter_fnt &instrumenter);
44
62
Outputs:
45
63
46
64
Purpose:
65
+ The function builds an instrumented copy of a passed hierarchy of
66
+ 'irept's in the same way as the function 'instrument' above. However,
67
+ this version allows the user to also specify a 'pivot' hierarchy of
68
+ 'irept's providing more refined instrumentation. For instance, the
69
+ instrumenter is called only on that topological part of the hierarchy
70
+ matching the topology of the pivot. Also, the instrumenter called for
71
+ some node may use the corresponding pivot node to decide how the
72
+ instrumentation will be performed. For example, imagine two nodes of
73
+ the exactly the same kind of the instrumenter passed with the different
74
+ kinds of pivot nodes. The intrumenter may then return nodes of different
75
+ kinds (according to kinds of pivot nodes).
47
76
48
77
\*******************************************************************/
49
78
irept instrument_using_pivot (
0 commit comments