Rate This Document
Findability
Accuracy
Completeness
Readability

Generating a BC File

A BC file is used for memory consistency check and vectorization check.

Command Function

Scans the source file to generate a BC file.

Modify the build file before generating a BC file:

  • Replace the compilation command: If the build file contains gcc, g++, gfortran, or ld, replace them with gclang, gclang++, gflang, or llvm-link.

    llvm-link does not support library files. If the ld command includes a library file, replace the ld command with gclang, gclang++, or gflang based on the programming language.

  • Modify the compilation option: Set the tuning level to -O0 and add the compilation option -g -fno-inline-functions.

Syntax

devkit advisor bc-gen {-i INPUT_PATH | --input INPUT_PATH} {-c COMMAND | --cmd COMMAND} [-o OUTPUT_PATH | --output OUTPUT_PATH] [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT]

Parameter Description

Table 1 Parameter description

Parameter

Option

Description

-h/--help

-

Obtains help information.

-i/--input

-

Path of the source code folder for which a BC file is to be generated.

NOTE:

If the source file contains multiple subdirectories that depend on each other during the compilation, enter the entire source file and add the cd command to the -c parameter so that you can access a subdirectory when scanning the subdirectory.

-c/--cmd

-

Source code build command.

-o/--output

-

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

-

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.
  • 0: DEBUG
  • 1: INFO
  • 2: WARNING
  • 3: ERROR

Example

Scan the source file in /home/test. The compilation command is make. The BC file is stored in /home/test/bc_files.

devkit advisor bc-gen -i /home/test -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:
     Scan source code path: /home/test
     Generate bc files path: /home/test/bc_files
     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
    /home/test/bc_files/bc-gen_20240110200505123_0c24