Generating a BC File
A BC file is used for memory consistency check and vectorization check.
Command Function
Compiles the source file to generate a BC file.
Ensure that the source file used to generate the BC file can be compiled locally using the compilation command provided.
Syntax
devkit advisor bc-gen [-h | --help] {-c COMMAND | --command COMMAND} [-o OUTPUT_PATH | --output OUTPUT_PATH] [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT] [-t THREADS | --thread THREADS]
Parameter Description
Parameter |
Option |
Description |
|---|---|---|
-h/--help |
- |
Obtains help information. |
-c/--command |
command |
Source code build command. This parameter is mandatory. Example: make all NOTE:
The source code build command in the command line tool does not support variable setting and environment variable export. Example: "CFLAGS='-O0 -g';make" or "export CFLAGS='-O0 -g';make" |
-o/--output |
output_path |
Path for storing the generated BC file. You must have the write permission on the path. By default, the report is saved in the current path and is named in the format of Module name_Timestamp. |
--set-timeout |
time |
Timeout interval of a task, in minutes. If the execution duration exceeds the timeout interval, the task exits. By default, there is no timeout interval. The task will be executed until it is complete. |
-l/--log-level |
0/1/2/3 |
Log level, which defaults to 1.
|
-t/--threads |
thread_num |
Number of threads for compiling the BC file, which defaults to half of the total number of CPUs in the current environment. |
Example
Create a BC file.
In this example, the source file in the /home/test directory is scanned, the build commands are cmake . and make, and the BC file is stored in the /home/test/bc_files directory. Replace the example parameter values with the actual ones.
cd /home/test && cmake . devkit advisor bc-gen -c make -o /home/test/bc_files
The following information is displayed and a report is generated:
Executing bc generate task, please wait...
Current progress:
Scanned time: 20240110200505123
Configuration:
Generate bc files path: /home/test/bc_files
Compile command: make
Threads: The threads is not set, using the half number of cores.
Task Timeout Interval: The timeout period is not set.
Log level: info
Summary:
Scanned all source files, there are 2 bc files generated.
For the detail information, please check:
Output path of linked bc files: /home/test/bc_files/bc-gen_20240813081929_c42a/bin
Output path of object bc files: /home/test/bc_files/bc-gen_20240813081929_c42a/object
For the causes of the failure to generate the bc files of some files, please check:
Log path: /install_path/advisor/logs/affinity/affinity.log
Warning and error messages when generate the bc files: /current_path/bc_warning.json
- If the BC file fails to be generated, view the error details in /current_path/bc_warning.json and /install_path/advisor/logs/affinity/affinity.log. For details about how to rectify errors, see Compatibility in the BiSheng Compiler User Guide.
- current_path indicates the current path and install_path indicates the tool installation directory.