Linux command
llc 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Compile LLVM IR to assembly
llc [input.ll]
Output to file
llc -o [output.s] [input.ll]
Compile to object file
llc -filetype=obj [input.ll]
Target specific architecture
llc -march=[x86-64] [input.ll]
Optimization level
llc -O[2] [input.ll]
List targets
llc --version
说明
llc is the LLVM static compiler that translates LLVM intermediate representation (IR) into native machine code. It accepts input in either LLVM bitcode (.bc) or human-readable LLVM assembly (.ll) format and produces target-specific assembly language or object files. As the backend stage of the LLVM compilation pipeline, llc performs instruction selection, register allocation, and machine-specific optimizations to generate efficient code for the target architecture. The tool supports a wide range of target architectures including x86, ARM, AArch64, MIPS, RISC-V, and others, selectable via the `-march` and `-mtriple` flags. Optimization levels from `-O0` (no optimization) through `-O3` (aggressive optimization) control how much effort llc spends on code improvement during compilation. Output can be either textual assembly (default) or a relocatable object file when using `-filetype=obj`, making llc useful both for inspecting generated code and for producing linkable artifacts directly.
参数
- -o _FILE_
- Output file name.
- -filetype _TYPE_
- Output type (asm, obj, null).
- -march _ARCH_
- Target architecture.
- -O _LEVEL_
- Optimization level (0-3).
- -mtriple _TRIPLE_
- Target triple.
- --help
- Display help information.
FAQ
What is the llc command used for?
llc is the LLVM static compiler that translates LLVM intermediate representation (IR) into native machine code. It accepts input in either LLVM bitcode (.bc) or human-readable LLVM assembly (.ll) format and produces target-specific assembly language or object files. As the backend stage of the LLVM compilation pipeline, llc performs instruction selection, register allocation, and machine-specific optimizations to generate efficient code for the target architecture. The tool supports a wide range of target architectures including x86, ARM, AArch64, MIPS, RISC-V, and others, selectable via the `-march` and `-mtriple` flags. Optimization levels from `-O0` (no optimization) through `-O3` (aggressive optimization) control how much effort llc spends on code improvement during compilation. Output can be either textual assembly (default) or a relocatable object file when using `-filetype=obj`, making llc useful both for inspecting generated code and for producing linkable artifacts directly.
How do I run a basic llc example?
Run `llc [input.ll]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -o _FILE_ do in llc?
Output file name.