[all-commits] [llvm/llvm-project] 142aa1: [Support] Move Target/CPU Printing out of CommandLine

Sam Elliott via All-commits all-commits at lists.llvm.org
Tue Dec 20 01:56:45 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 142aa1bdd1dd1db9a7fecf9d157228019c794c94
      https://github.com/llvm/llvm-project/commit/142aa1bdd1dd1db9a7fecf9d157228019c794c94
  Author: Archibald Elliott <archibald.elliott at arm.com>
  Date:   2022-12-20 (Tue, 20 Dec 2022)

  Changed paths:
    M llvm/include/llvm/Support/Host.h
    M llvm/lib/MC/TargetRegistry.cpp
    M llvm/lib/Support/CommandLine.cpp
    M llvm/lib/Support/Host.cpp
    M llvm/test/tools/llvm-libtool-darwin/ignored-options.test
    M llvm/tools/llc/llc.cpp
    M llvm/tools/llvm-exegesis/llvm-exegesis.cpp
    M llvm/tools/llvm-mca/llvm-mca.cpp
    M llvm/tools/opt/opt.cpp

  Log Message:
  -----------
  [Support] Move Target/CPU Printing out of CommandLine

This change is rather more invasive than intended. The main intention
here is to make CommandLine.cpp not rely on llvm/Support/Host.h. Right
now, this reliance is only in 3 superficial places:
- Choosing how to expand response files (in two places)
- Printing the default triple and current CPU in `--version` output.

The built in version system has a method for adding "extra version
printers", commonly used by several tools (such as llc) to report the
registered targets in the built version of LLVM. It was reasonably easy
to move the logic for printing the default triple and current CPU into
a similar function, and register it with any relevant binaries.

The incompatible change here is that now, even if
LLVM_VERSION_PRINTER_SHOW_HOST_TARGET_INFO is defined, most binaries
will no longer print out the default target triple and cpu when provided
with `--version`, for instance llvm-as and llvm-dis. This breakage is
intended, but the changes in this patch keep printing the default target
and detected in `llc` and `opt` as these were remarked as important
binaries in the LLVM install.

The change to expanding response files may also be controversial, but I
believe that these macros should correspond exactly to the host triple
introspection used before.

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




More information about the All-commits mailing list