[docs][tools] Add missing "program" tags to rst files

Sphinx allows for definitions of command-line options using
`.. option <name>` and references to those options via `:option:<name>`.
However, it looks like there is no scoping of these options by default,
meaning that links can end up pointing to incorrect documents. See for
example the llvm-mca document, which contains references to -o that,
prior to this patch, pointed to a different document. What's worse is
that these links appear to be non-deterministic in which one is picked
(on my machine, some references end up pointing to opt, whereas on the
live docs, they point to llvm-dwarfdump, for example).

The fix is to add the .. program <name> tag. This essentially namespaces
the options (definitions and references) to the named program, ensuring
that the links are kept correct.

Reviwed by: andreadb

Differential Revision: https://reviews.llvm.org/D63873

llvm-svn: 364538
diff --git a/llvm/docs/CommandGuide/FileCheck.rst b/llvm/docs/CommandGuide/FileCheck.rst
index 36f517e..a424606 100644
--- a/llvm/docs/CommandGuide/FileCheck.rst
+++ b/llvm/docs/CommandGuide/FileCheck.rst
@@ -1,6 +1,8 @@
 FileCheck - Flexible pattern matching file verifier
 ===================================================
 
+.. program:: FileCheck
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/bugpoint.rst b/llvm/docs/CommandGuide/bugpoint.rst
index 8c2a0d1..4a8ce93 100644
--- a/llvm/docs/CommandGuide/bugpoint.rst
+++ b/llvm/docs/CommandGuide/bugpoint.rst
@@ -1,6 +1,8 @@
 bugpoint - automatic test case reduction tool
 =============================================
 
+.. program:: bugpoint
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/dsymutil.rst b/llvm/docs/CommandGuide/dsymutil.rst
index ceaa540..79925a7 100644
--- a/llvm/docs/CommandGuide/dsymutil.rst
+++ b/llvm/docs/CommandGuide/dsymutil.rst
@@ -1,6 +1,8 @@
 dsymutil - manipulate archived DWARF debug symbol files
 =======================================================
 
+.. program:: dsymutil
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/lit.rst b/llvm/docs/CommandGuide/lit.rst
index e0d09ae..bcaa5c6 100644
--- a/llvm/docs/CommandGuide/lit.rst
+++ b/llvm/docs/CommandGuide/lit.rst
@@ -1,6 +1,8 @@
 lit - LLVM Integrated Tester
 ============================
 
+.. program:: lit
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llc.rst b/llvm/docs/CommandGuide/llc.rst
index aaf7e2e..bf62957 100644
--- a/llvm/docs/CommandGuide/llc.rst
+++ b/llvm/docs/CommandGuide/llc.rst
@@ -1,6 +1,8 @@
 llc - LLVM static compiler
 ==========================
 
+.. program:: llc
+
 SYNOPSIS
 --------
 
@@ -41,6 +43,11 @@
 
  Print a summary of command line options.
 
+.. option:: -o <filename>
+
+ Use ``<filename>`` as the output filename. See the summary above for more
+ details.
+
 .. option:: -O=uint
 
  Generate code at different optimization levels.  These correspond to the
diff --git a/llvm/docs/CommandGuide/lli.rst b/llvm/docs/CommandGuide/lli.rst
index 1132ac3..6d8cb4b 100644
--- a/llvm/docs/CommandGuide/lli.rst
+++ b/llvm/docs/CommandGuide/lli.rst
@@ -1,6 +1,8 @@
 lli - directly execute programs from LLVM bitcode
 =================================================
 
+.. program:: lli
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-ar.rst b/llvm/docs/CommandGuide/llvm-ar.rst
index d10ec91..2d82abc 100644
--- a/llvm/docs/CommandGuide/llvm-ar.rst
+++ b/llvm/docs/CommandGuide/llvm-ar.rst
@@ -1,6 +1,7 @@
 llvm-ar - LLVM archiver
 =======================
 
+.. program:: llvm-ar
 
 SYNOPSIS
 --------
diff --git a/llvm/docs/CommandGuide/llvm-as.rst b/llvm/docs/CommandGuide/llvm-as.rst
index 1b499bb..77b1568 100644
--- a/llvm/docs/CommandGuide/llvm-as.rst
+++ b/llvm/docs/CommandGuide/llvm-as.rst
@@ -1,6 +1,8 @@
 llvm-as - LLVM assembler
 ========================
 
+.. program:: llvm-as
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-bcanalyzer.rst b/llvm/docs/CommandGuide/llvm-bcanalyzer.rst
index 7254088..369ea5e 100644
--- a/llvm/docs/CommandGuide/llvm-bcanalyzer.rst
+++ b/llvm/docs/CommandGuide/llvm-bcanalyzer.rst
@@ -1,6 +1,8 @@
 llvm-bcanalyzer - LLVM bitcode analyzer
 =======================================
 
+.. program:: llvm-bcanalyzer
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-build.rst b/llvm/docs/CommandGuide/llvm-build.rst
index f788f7c..d0331ca 100644
--- a/llvm/docs/CommandGuide/llvm-build.rst
+++ b/llvm/docs/CommandGuide/llvm-build.rst
@@ -1,6 +1,7 @@
 llvm-build - LLVM Project Build Utility
 =======================================
 
+.. program:: llvm-build
 
 SYNOPSIS
 --------
diff --git a/llvm/docs/CommandGuide/llvm-config.rst b/llvm/docs/CommandGuide/llvm-config.rst
index 34075d0..caee955 100644
--- a/llvm/docs/CommandGuide/llvm-config.rst
+++ b/llvm/docs/CommandGuide/llvm-config.rst
@@ -1,6 +1,7 @@
 llvm-config - Print LLVM compilation options
 ============================================
 
+.. program:: llvm-config
 
 SYNOPSIS
 --------
diff --git a/llvm/docs/CommandGuide/llvm-cov.rst b/llvm/docs/CommandGuide/llvm-cov.rst
index 7d696c9..d464976 100644
--- a/llvm/docs/CommandGuide/llvm-cov.rst
+++ b/llvm/docs/CommandGuide/llvm-cov.rst
@@ -1,6 +1,8 @@
 llvm-cov - emit coverage information
 ====================================
 
+.. program:: llvm-cov
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-cxxfilt.rst b/llvm/docs/CommandGuide/llvm-cxxfilt.rst
index aad1ccd..1b6f9c6 100644
--- a/llvm/docs/CommandGuide/llvm-cxxfilt.rst
+++ b/llvm/docs/CommandGuide/llvm-cxxfilt.rst
@@ -1,6 +1,8 @@
 llvm-cxxfilt - LLVM symbol name demangler
 =========================================
 
+.. program:: llvm-cxxfilt
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-cxxmap.rst b/llvm/docs/CommandGuide/llvm-cxxmap.rst
index 7293f60..b0bf1c4 100644
--- a/llvm/docs/CommandGuide/llvm-cxxmap.rst
+++ b/llvm/docs/CommandGuide/llvm-cxxmap.rst
@@ -1,6 +1,8 @@
 llvm-cxxmap - Mangled name remapping tool
 =========================================
 
+.. program:: llvm-cxxmap
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-diff.rst b/llvm/docs/CommandGuide/llvm-diff.rst
index 991d4fe..b858b98 100644
--- a/llvm/docs/CommandGuide/llvm-diff.rst
+++ b/llvm/docs/CommandGuide/llvm-diff.rst
@@ -1,6 +1,7 @@
 llvm-diff - LLVM structural 'diff'
 ==================================
 
+.. program:: llvm-diff
 
 SYNOPSIS
 --------
diff --git a/llvm/docs/CommandGuide/llvm-dis.rst b/llvm/docs/CommandGuide/llvm-dis.rst
index 85cdca8..aaba128 100644
--- a/llvm/docs/CommandGuide/llvm-dis.rst
+++ b/llvm/docs/CommandGuide/llvm-dis.rst
@@ -1,6 +1,7 @@
 llvm-dis - LLVM disassembler
 ============================
 
+.. program:: llvm-dis
 
 SYNOPSIS
 --------
diff --git a/llvm/docs/CommandGuide/llvm-dwarfdump.rst b/llvm/docs/CommandGuide/llvm-dwarfdump.rst
index b8ebc8a..e2cec42 100644
--- a/llvm/docs/CommandGuide/llvm-dwarfdump.rst
+++ b/llvm/docs/CommandGuide/llvm-dwarfdump.rst
@@ -1,6 +1,8 @@
 llvm-dwarfdump - dump and verify DWARF debug information
 ========================================================
 
+.. program:: llvm-dwarfdump
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-exegesis.rst b/llvm/docs/CommandGuide/llvm-exegesis.rst
index cbb9009..8f9ec1e 100644
--- a/llvm/docs/CommandGuide/llvm-exegesis.rst
+++ b/llvm/docs/CommandGuide/llvm-exegesis.rst
@@ -1,6 +1,8 @@
 llvm-exegesis - LLVM Machine Instruction Benchmark
 ==================================================
 
+.. program:: llvm-exegesis
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-extract.rst b/llvm/docs/CommandGuide/llvm-extract.rst
index d0e9c1c..345496b 100644
--- a/llvm/docs/CommandGuide/llvm-extract.rst
+++ b/llvm/docs/CommandGuide/llvm-extract.rst
@@ -1,6 +1,8 @@
 llvm-extract - extract a function from an LLVM module
 =====================================================
 
+.. program:: llvm-extract
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-lib.rst b/llvm/docs/CommandGuide/llvm-lib.rst
index ecd0a7d..87687be 100644
--- a/llvm/docs/CommandGuide/llvm-lib.rst
+++ b/llvm/docs/CommandGuide/llvm-lib.rst
@@ -1,6 +1,7 @@
 llvm-lib - LLVM lib.exe compatible library tool
 ===============================================
 
+.. program:: llvm-lib
 
 SYNOPSIS
 --------
diff --git a/llvm/docs/CommandGuide/llvm-link.rst b/llvm/docs/CommandGuide/llvm-link.rst
index 3bcfa68..7619979 100644
--- a/llvm/docs/CommandGuide/llvm-link.rst
+++ b/llvm/docs/CommandGuide/llvm-link.rst
@@ -1,6 +1,8 @@
 llvm-link - LLVM bitcode linker
 ===============================
 
+.. program:: llvm-link
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-lipo.rst b/llvm/docs/CommandGuide/llvm-lipo.rst
index ebc540a..13f5634 100644
--- a/llvm/docs/CommandGuide/llvm-lipo.rst
+++ b/llvm/docs/CommandGuide/llvm-lipo.rst
@@ -1,6 +1,8 @@
 llvm-lipo - LLVM tool for manipulating universal binaries
 =========================================================
 
+.. program:: llvm-lipo
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-mca.rst b/llvm/docs/CommandGuide/llvm-mca.rst
index 847a043..a021033 100644
--- a/llvm/docs/CommandGuide/llvm-mca.rst
+++ b/llvm/docs/CommandGuide/llvm-mca.rst
@@ -1,6 +1,8 @@
 llvm-mca - LLVM Machine Code Analyzer
 =====================================
 
+.. program:: llvm-mca
+
 SYNOPSIS
 --------
 
@@ -64,6 +66,11 @@
 
  Print a summary of command line options.
 
+.. option:: -o <filename>
+
+ Use ``<filename>`` as the output filename. See the summary above for more
+ details.
+
 .. option:: -mtriple=<target triple>
 
  Specify a target triple string.
diff --git a/llvm/docs/CommandGuide/llvm-nm.rst b/llvm/docs/CommandGuide/llvm-nm.rst
index 85e66d7..6268b15 100644
--- a/llvm/docs/CommandGuide/llvm-nm.rst
+++ b/llvm/docs/CommandGuide/llvm-nm.rst
@@ -1,6 +1,8 @@
 llvm-nm - list LLVM bitcode and object file's symbol table
 ==========================================================
 
+.. program:: llvm-nm
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-objdump.rst b/llvm/docs/CommandGuide/llvm-objdump.rst
index 3a4549e..be4d07c 100644
--- a/llvm/docs/CommandGuide/llvm-objdump.rst
+++ b/llvm/docs/CommandGuide/llvm-objdump.rst
@@ -1,6 +1,8 @@
 llvm-objdump - LLVM's object file dumper
 ========================================
 
+.. program:: llvm-objdump
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-pdbutil.rst b/llvm/docs/CommandGuide/llvm-pdbutil.rst
index 29d487e..9553531 100644
--- a/llvm/docs/CommandGuide/llvm-pdbutil.rst
+++ b/llvm/docs/CommandGuide/llvm-pdbutil.rst
@@ -1,6 +1,8 @@
 llvm-pdbutil - PDB File forensics and diagnostics
 =================================================
 
+.. program:: llvm-pdbutil
+
 .. contents::
    :local:
 
diff --git a/llvm/docs/CommandGuide/llvm-profdata.rst b/llvm/docs/CommandGuide/llvm-profdata.rst
index 7f5887a..bc0a006 100644
--- a/llvm/docs/CommandGuide/llvm-profdata.rst
+++ b/llvm/docs/CommandGuide/llvm-profdata.rst
@@ -1,6 +1,8 @@
 llvm-profdata - Profile data tool
 =================================
 
+.. program:: llvm-profdata
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-readobj.rst b/llvm/docs/CommandGuide/llvm-readobj.rst
index d533ae5..7c3b946 100644
--- a/llvm/docs/CommandGuide/llvm-readobj.rst
+++ b/llvm/docs/CommandGuide/llvm-readobj.rst
@@ -1,6 +1,8 @@
 llvm-readobj - LLVM Object Reader
 =================================
 
+.. program:: llvm-readobj
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-stress.rst b/llvm/docs/CommandGuide/llvm-stress.rst
index fb006f5..7f23681 100644
--- a/llvm/docs/CommandGuide/llvm-stress.rst
+++ b/llvm/docs/CommandGuide/llvm-stress.rst
@@ -1,6 +1,8 @@
 llvm-stress - generate random .ll files
 =======================================
 
+.. program:: llvm-stress
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/llvm-symbolizer.rst b/llvm/docs/CommandGuide/llvm-symbolizer.rst
index 98f2554..7f3a8a4 100644
--- a/llvm/docs/CommandGuide/llvm-symbolizer.rst
+++ b/llvm/docs/CommandGuide/llvm-symbolizer.rst
@@ -1,6 +1,8 @@
 llvm-symbolizer - convert addresses into source code locations
 ==============================================================
 
+.. program:: llvm-symbolizer
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/opt.rst b/llvm/docs/CommandGuide/opt.rst
index 2b2fffa..10eff31 100644
--- a/llvm/docs/CommandGuide/opt.rst
+++ b/llvm/docs/CommandGuide/opt.rst
@@ -1,6 +1,8 @@
 opt - LLVM optimizer
 ====================
 
+.. program:: opt
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/CommandGuide/tblgen.rst b/llvm/docs/CommandGuide/tblgen.rst
index 3105e0c..372d1b2 100644
--- a/llvm/docs/CommandGuide/tblgen.rst
+++ b/llvm/docs/CommandGuide/tblgen.rst
@@ -1,6 +1,8 @@
 tblgen - Target Description To C++ Code Generator
 =================================================
 
+.. program:: tblgen
+
 SYNOPSIS
 --------
 
diff --git a/llvm/docs/WritingAnLLVMPass.rst b/llvm/docs/WritingAnLLVMPass.rst
index 9e857fb..7e2cabb 100644
--- a/llvm/docs/WritingAnLLVMPass.rst
+++ b/llvm/docs/WritingAnLLVMPass.rst
@@ -2,6 +2,8 @@
 Writing an LLVM Pass
 ====================
 
+.. program:: opt
+
 .. contents::
     :local:
 
@@ -264,7 +266,7 @@
 you would go ahead and make it do the cool transformations you want.  Once you
 get it all working and tested, it may become useful to find out how fast your
 pass is.  The :ref:`PassManager <writing-an-llvm-pass-passmanager>` provides a
-nice command line option (:option:`--time-passes`) that allows you to get
+nice command line option (:option:`-time-passes`) that allows you to get
 information about the execution time of your pass along with the other passes
 you queue up.  For example: