diff --git a/llvm/docs/CommandGuide/index.rst b/llvm/docs/CommandGuide/index.rst --- a/llvm/docs/CommandGuide/index.rst +++ b/llvm/docs/CommandGuide/index.rst @@ -30,6 +30,7 @@ llvm-libtool-darwin llvm-link llvm-lipo + llvm-mc llvm-mca llvm-opt-report llvm-otool diff --git a/llvm/docs/CommandGuide/llvm-mc.rst b/llvm/docs/CommandGuide/llvm-mc.rst new file mode 100644 --- /dev/null +++ b/llvm/docs/CommandGuide/llvm-mc.rst @@ -0,0 +1,145 @@ +llvm-mc - LLVM Machine Code Playground +====================================== + +.. program:: llvm-mc + +SYNOPSIS +-------- + +:program:`llvm-mc` [*options*] [*filename*] + +DESCRIPTION +----------- + +The :program:`llvm-mc` command take input as the assembly code for a specified +architecture and generate object file or executable as a output for a specified. +`llvm-mc` provide powerful set of the tool for working with the machine code such +as encoding of their instruction and their internal representation, dissasemble +string to bytes etc. + +The choice of architecture for the output assembly code is automatically +determined from the input file, unless the :option:`--arch` option is used to +override the default. + +OPTIONS +------- + +If the :option:`-o` option is omitted, then :program:`llvm-mc` will send its output +to standard output if the input is from standard input. If the :option:`-o` +option specifies "``-``", then the output will also be sent to standard output. + +If no :option:`-o` option is specified and an input file other than "``-``" is +specified, then :program:`llvm-mc` creates the output filename by taking the input +filename, removing any existing ``.s`` extension, and adding a ``.o`` suffix. + +Other :program:`llvm-mc` options are described below. + +End-user Options +~~~~~~~~~~~~~~~~ + +.. option:: --help + + Display available options (--help-hidden for more). + +.. option:: -o + + Use ```` as the output filename. See the summary above for more + details. + +.. option:: --arch= + + Target arch to assemble for, see -version for available targets. + +.. option:: --as-lex + + Lex Token from input assembly file. + +.. option:: --assemble + + Assemble assembly file (default). + +.. option:: --disassemble + + Marked up disassembly of string to hex bytes. + +.. option:: --mdis + + Marked up disassembly of string of hex bytes. + +.. option:: -g + + Generate DWARF debugging info for assembly source files. + +.. option:: --large-code-model + + Create CFI directives that assume the code might be more than 2 GB. + +.. option:: --main-file-name= + + Specify the name we should consider the input file. + + +.. option:: --masm-hexfloats + + Enable MASM-style hex float initializers (3F800000r). + + +.. option:: -mattr=a1,+a2,-a3,... + Target specific attributes (-mattr=help for details). + +.. option:: --mcpu= + + Target a specific cpu type (-mcpu=help for details). + +.. option:: --triple= + + Target triple to assemble for, see -version for available targets. + +.. option:: --split-dwarf-file= + + DWO output filename. + +.. option:: --show-inst-operands + + Show instructions operands as parsed. + +.. option:: --show-inst + + Show internal instruction representation. + +.. option:: --show-encoding + + Show instruction encodings. + +.. option:: --save-temp-labels + + Don't discard temporary labels. + +.. option:: --relax-relocations + + Emit R_X86_64_GOTPCRELX instead of R_X86_64_GOTPCREL. + +.. option:: --print-imm-hex + + Prefer hex format for immediate values. + +.. option:: --preserve-comments + + Preserve Comments in outputted assembly. + +.. option:: --output-asm-variant= + + Syntax variant to use for output printing. + + +.. option:: --compress-debug-sections=[none|zlib|zstd] + + Choose DWARF debug sections compression. + + +EXIT STATUS +----------- + +If :program:`llvm-mc` succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non-zero value. +