[llvm] [docs] Document target options in `opt` command guide (NFC) (PR #213942)
Antonio Frighetto via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 5 09:52:00 PDT 2026
https://github.com/antoniofrighetto updated https://github.com/llvm/llvm-project/pull/213942
>From 645ff5ff508d3ffd0a03887ea18f94013eb51ce9 Mon Sep 17 00:00:00 2001
From: Antonio Frighetto <me at antoniofrighetto.com>
Date: Tue, 4 Aug 2026 15:15:05 +0200
Subject: [PATCH] [docs] Document target options in `opt` command guide (NFC)
`-mtriple` option has been supported for a long time, but lacked
documentation. The same applies to codegen-specific flags (such
as `-march`, `-mcpu`, etc., which are registered via
`codegen::RegisterCodeGenFlags`), whose most commonly used entries
may be worth documenting as well.
---
llvm/docs/CommandGuide/opt.rst | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/llvm/docs/CommandGuide/opt.rst b/llvm/docs/CommandGuide/opt.rst
index c15f7ec05b712..a5769f5c284c6 100644
--- a/llvm/docs/CommandGuide/opt.rst
+++ b/llvm/docs/CommandGuide/opt.rst
@@ -53,6 +53,28 @@ OPTIONS
`invoking opt <../NewPassManager.html#invoking-opt>`_ for more details on the
pass pipeline syntax.
+.. option:: -mtriple=<target triple>
+
+ Override the target triple specified in the input file with the specified
+ string.
+
+.. option:: -march=<arch>
+
+ Specify the architecture for which to generate LLVM IR, overriding the target
+ encoded in the input file. See the output of ``opt -help`` for a list of
+ valid architectures. By default this is inferred from the target triple or
+ autodetected to the current architecture.
+
+.. option:: -mcpu=<cpuname>
+
+ Specify a specific chip in the current architecture to generate LLVM IR for.
+ By default this is inferred from the target triple and autodetected to
+ the current architecture. For a list of available CPUs, use:
+
+ .. code-block:: none
+
+ llvm-as < /dev/null | opt -mcpu=help
+
.. option:: -mtune=<cpuname>
Specify a specific chip microarchitecture in the current architecture
More information about the llvm-commits
mailing list