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
- ex.cpp: Source code of the SUIF pass
- Makefile: Make file that produces a library in ${NCIHOME}/solib
- test.c: A small C test program
Compiling and executing the SUIF Pass
# compile the SUIF pass
example> gmake
...
# generate a SUIF file for the test.c program
example> c2s test.c
/elba/e11/lam/src/nci/bin/suifint out.il test.suif
# ex.c is written to operate on call statements
# convert call expressions to call statements
# count the calls first iteratively, then with a walker
example> suifdriver -i
suif> import transforms
suif> load test.suif
suif> call_expression_dismantler
suif> import ex
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>