Skip to content

Commit 954dd0a

Browse files
committed
Updates requested in the PR: comments.
1 parent 624a80e commit 954dd0a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/taint-slicer/irept_instrument.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ proces of "irept" hierarchical and shared data structures.
1919
#include <util/irep.h>
2020
#include <functional>
2121

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).
2229
typedef std::function<irept(irept)> instrumenter_fnt;
2330
typedef std::function<irept(irept, irept)> pivot_instrumenter_fnt;
2431

@@ -31,6 +38,17 @@ typedef std::function<irept(irept, irept)> pivot_instrumenter_fnt;
3138
Outputs:
3239
3340
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.
3452
3553
\*******************************************************************/
3654
irept instrument(const irept irep, const instrumenter_fnt &instrumenter);
@@ -44,6 +62,17 @@ irept instrument(const irept irep, const instrumenter_fnt &instrumenter);
4462
Outputs:
4563
4664
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).
4776
4877
\*******************************************************************/
4978
irept instrument_using_pivot(

0 commit comments

Comments
 (0)