Example of a SUIF Pass

A simple example that illustrates the use of an iterator or a walker to report the number of direct and indirect calls in each procedure.

Files


Compiling and executing the SUIF Pass

# compile the SUIF pass
example> gmake
...

# generate a SUIF file for the test.c program
example> c2suif test.c
/elba/e11/lam/src/nci/bin/suifint  out.il test.suif

# count the calls first iteratively, then with a walker

example> suifdriver -i
suif> import ex
suif> load test.suif
suif> count_calls_iteratively
(Iterator) Caller: foo  Direct: 0, Indirect: 0
(Iterator) Caller: main  Direct: 1, Indirect: 2
suif> count_calls_with_a_walker
(Walker) Caller: foo  Direct: 0, Indirect: 0
(Walker) Caller: main  Direct: 1, Indirect: 2
suif> 
example>