-
Notifications
You must be signed in to change notification settings - Fork 15
bf inst
bf-inst - Insert Byfl instrumentation into an LLVM bitcode file
bf-inst [-o bitcode_file] [-Oopt_level] [--bf-verbose] [--bf-clang-args] [-bf-plugin=path/to/bytesflops.so] [--bf-static] [Byfl options] bitcode_file
bf-inst --help
bf-inst uses Byfl to instrument a given LLVM bitcode file with tallies of how many times various operations were executed. It serves as a lower-level interface to Byfl instrumentation than that which is provided by bf-clang and related Byfl compiler wrapper scripts in that bf-inst expects the user already to have produced LLVM bitcode from program source code.
-
--help
Display bf-inst usage information.
-
-o bitcode_file
Specify the name of the bitcode file to generate. If not specified, the input file is overwritten.
-
-Oopt_level
Designate the optimization level at which opt should optimize the bitcode after Byfl instrumentation has been applied.
-
--bf-verbose
Display all of the file operations that bf-inst performs.
-
-bf-plugin=path/to/bytesflops.so
Point bf-inst to the Byfl plugin (
bytesflops.so
). -
--bf-clang-args
Instead of instrumenting any bitcode, display a command-line fragment that can be passed to clang or clang++ to instruct those programs to invoke Byfl themselves.
-
-bf-static
Output static instruction counts at compile time.
bf-inst passes any additional options, such as -bf-by-func, to LLVM's opt program. The other Byfl wrapper-script man pages (e.g., bf-clang(1)) document all of the Byfl-specific options.
The command line ends with a list of bitcode files. These may be in
binary (.bc
) or ASCII (.ll
) format and can even be renamed
(e.g., to .o
in case an existing Makefile
is retrofitted to emit
bitcode without altering output filenames). In addition, bf-inst
automatically instruments the contents of ar (.a
) archives.
bf-inst is intended to be used on existing bitcode files as an explicit part of the build process:
clang -O2 -emit-llvm -c myfile.c -o myfile.bc
bf-inst -bf-verbose -bf-types -bf-by-func myfile.bc
clang -o myfile myfile.bc -lbyfl
An alternative way to use bf-inst is
clang -O2 `bf-inst -bf-clang-args -bf-types -bf-by-func` \
-o myfile.o -c myfile.c
This has the advantage of being easier to integrate into an existing build system but the disadvantage that Byfl instrumentation is performed in the middle of LLVM's set of optimization passes instead of after all optimizations have been performed. Furthermore, it sacrifices the post-instrumentation optimization pass.
Scott Pakin, [email protected]
ar(1), bf-clang(1), clang(1), opt(1), the Byfl README file