benchbuild.utils.compiler module¶
Helper functions for dealing with compiler replacement.
This provides a few key functions to deal with varying/measuring the compilers used inside the benchbuild study. From a high-level view, there are 2 interesting functions:
- cc(project, detect_project=True)
- cxx(project, detect_project=True)
These generate a wrapped clang/clang++ in the current working directory and hide the given cflags/ldflags from the calling build system. Both will give you a working plumbum command and call a python script that redirects to the real clang/clang++ given the additional cflags&ldflags.
- The wrapper-script generated for both functions can be found inside:
- wrap_cc()
Are just convencience methods that can be used when interacting with the configured llvm/clang source directories.
-
benchbuild.utils.compiler.
cc
(project, detect_project=False)[source]¶ Return a clang that hides CFLAGS and LDFLAGS.
This will generate a wrapper script in the current directory and return a complete plumbum command to it.
Parameters: - cflags – The CFLAGS we want to hide.
- ldflags – The LDFLAGS we want to hide.
- func (optional) – A function that will be pickled alongside the compiler. It will be called before the actual compilation took place. This way you can intercept the compilation process with arbitrary python code.
- Returns (benchbuild.utils.cmd):
- Path to the new clang command.
-
benchbuild.utils.compiler.
compiler
(name)[source]¶ Get a usable clang++ plumbum command.
This searches for a usable clang++ in the llvm binary path
Returns: plumbum Command that executes clang++
-
benchbuild.utils.compiler.
cxx
(project, detect_project=False)[source]¶ Return a clang++ that hides CFLAGS and LDFLAGS.
This will generate a wrapper script in the current directory and return a complete plumbum command to it.
Parameters: - cflags – The CFLAGS we want to hide.
- ldflags – The LDFLAGS we want to hide.
- func (optional) – A function that will be pickled alongside the compiler. It will be called before the actual compilation took place. This way you can intercept the compilation process with arbitrary python code.
- Returns (benchbuild.utils.cmd):
- Path to the new clang command.