llvm-as
Assemble LLVM assembly language into bitcode
TLDR
Assemble an IR file
Assemble an IR file and include a module hash in the produced Bitcode file
Read an IR file from stdin and assemble it
SYNOPSIS
llvm-as [options] []
PARAMETERS
-f
Enable binary output on terminals. Normally, llvm-as will refuse to write raw bitcode output if the standard output is a terminal.
-o
Specify the output file name. If filename is '-', then standard output is used.
-help
Display available options.
-version
Display the version of llvm-as.
DESCRIPTION
llvm-as is a command-line tool that assembles LLVM assembly language (.ll) files into LLVM bitcode (.bc) files. It reads LLVM IR code, parses it, and translates it into the binary bitcode format suitable for execution or further processing by other LLVM tools like llvm-link, opt, and llc. The primary purpose of llvm-as is to provide a way to convert human-readable LLVM IR code into a compact and efficient binary representation.
It accepts input either from a specified file or from standard input if no file is specified. The output can be directed to a file or to standard output. This tool is essential for compiling hand-written LLVM IR, generating bitcode from other languages (using frontends that target LLVM IR), and testing/debugging purposes. When no options are specified the output is sent to standard output.
llvm-as is part of the LLVM toolchain and is generally used in conjunction with other LLVM utilities to build and manipulate programs. Errors during assembly result in diagnostic messages printed to standard error.
EXIT STATUS
llvm-as exits with a non-zero status if an error occurs during assembly. Otherwise, it exits with status 0.
INPUT
The input to llvm-as must be a valid LLVM assembly language file (.ll). The tool parses the input and generates bitcode if the input is syntactically and semantically correct according to the LLVM IR specification.
HISTORY
llvm-as has been a core component of the LLVM project since its inception. It provides the fundamental functionality of converting LLVM assembly language into bitcode, a critical step in the LLVM compilation pipeline. Its development has closely mirrored the evolution of the LLVM Intermediate Representation (IR), ensuring compatibility and support for new language features and optimizations. Over the years, llvm-as has been refined for performance, robustness, and adherence to the LLVM IR specification, enabling developers to work efficiently with LLVM-based tools.