Tiancheng Code Optimizer Functions
The Tiancheng Code Optimizer is a static code analysis tool built on Clang/LLVM, focusing on vectorized optimization of C/C++ code. The tool automatically identifies vectorizable loop patterns and supports x86 Intel intrinsics analysis to detect x86 vectorized instructions. It automatically generates Arm vectorized code for automatic rewriting. These capabilities help developers quickly convert scalar code into efficient Arm vectorized code and fully leverage the performance benefits of NEON/
The tool supports the following modes:
- Flame graph scanning mode (preferred): You can extract hotspot functions from a flame graph SVG file or a Performance Boundary Analyzer result JSON file and analyze them, helping you quickly identify functions or code that may have optimization opportunities.
- Function scanning mode: You can analyze specified functions to quickly identify those that can be vectorized.
- File scanning mode: This mode supports single-file scanning and full-project scanning. You can analyze a single source file or the entire project to identify code that can be vectorized for optimization.
By default, scalar code is scanned in the preceding modes. When x86 Intel intrinsics analysis is enabled, x86 vectorized instructions can be scanned.
Prerequisites
- The Tiancheng Code Optimizer has been installed.
- The tool is contained in an independent package (tiancheng-x.x.x-Linux-Kunpeng.tar.gz). Extract the package and switch to the tool directory.
Command Function
Automatically identifies vectorizable loop patterns and supports x86 Intel intrinsics analysis to detect x86 vectorized instructions, and also automatically generates Arm vectorized code for automatic rewriting.
Syntax
./tiancheng <subcommand> [options]
Example
./tiancheng -h
Command output:
OVERVIEW: Tiancheng C/C++ Vectorization Analyzer USAGE: tiancheng <subcommand> [options] SUBCOMMANDS: file Analyze one input file or all C/C++ files under a project directory flamegraph Use an imported flamegraph/hotspot result as the analysis scope function Analyze explicitly specified functions Type "tiancheng <subcommand> --help" to get more help on a specific subcommand. OPTIONS: -h/--help Display available commands --version Display the version of this program
Subcommand |
Description |
|---|---|
file |
It supports single-file scanning and full-project scanning. You can analyze a single source file or the entire project to identify vectorizable code and receive rewriting suggestions. |
flamegraph |
You can extract hotspot functions from a flame graph SVG file or a Performance Boundary Analyzer result JSON file and analyze them to quickly identify functions or code that have optimization opportunities and receive rewriting suggestions. |
function |
You can analyze specified functions to quickly identify vectorizable functions and receive rewriting suggestions. |