[libc-commits] [PATCH] D137838: [RFC][Support] Move TargetParsers to new component

Francesco Petrogalli via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Nov 16 12:53:17 PST 2022


fpetrogalli added a comment.

@lenary - thank you for the update!

I have added a bunch of miso comments, a bit repetitive... by the time I realised they were repetitive it was faster to get to the bottom of it than removing them!

In D137838#3931295 <https://reviews.llvm.org/D137838#3931295>, @lenary wrote:

> I've updated the patch to use forwarding headers (and to rebase past some changes that have happened in the interim).
>
> The patch is still huge because of the number of places using the TargetParsers, which need the component added to their CMakeLists.txt.
>
> I think after the next release, I will add `#warning` to the forwarding headers, so their usage can be noticed and updated.

Why not add the `#warning` directive now?

Thank you again,

Francesco



================
Comment at: clang/lib/Lex/CMakeLists.txt:3
 
-set(LLVM_LINK_COMPONENTS support)
+set(LLVM_LINK_COMPONENTS
+  Support
----------------
I wonder how `support` was not being detected as a linking error...


================
Comment at: clang/lib/Tooling/DumpTool/CMakeLists.txt:5
   ClangSrcLocDump.cpp
-)
+  )
 
----------------
nit: unrelated change.


================
Comment at: flang/tools/bbc/CMakeLists.txt:2-4
+  Passes
+  TargetParser
+  )
----------------
nit: extra tabs


================
Comment at: flang/unittests/Optimizer/CMakeLists.txt:14
   ${dialect_libs}
 )
 
----------------
Why not add `LLVMTargetParser` here?


================
Comment at: llvm/include/llvm/ADT/Triple.h:1
-//===-- llvm/ADT/Triple.h - Target triple helper class ----------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_TRIPLE_H
-#define LLVM_ADT_TRIPLE_H
-
-#include "llvm/ADT/Twine.h"
-#include "llvm/Support/VersionTuple.h"
-
-// Some system headers or GCC predefined macros conflict with identifiers in
-// this file.  Undefine them here.
-#undef NetBSD
-#undef mips
-#undef sparc
-
-namespace llvm {
-
-/// Triple - Helper class for working with autoconf configuration names. For
-/// historical reasons, we also call these 'triples' (they used to contain
-/// exactly three fields).
-///
-/// Configuration names are strings in the canonical form:
-///   ARCHITECTURE-VENDOR-OPERATING_SYSTEM
-/// or
-///   ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT
-///
-/// This class is used for clients which want to support arbitrary
-/// configuration names, but also want to implement certain special
-/// behavior for particular configurations. This class isolates the mapping
-/// from the components of the configuration name to well known IDs.
-///
-/// At its core the Triple class is designed to be a wrapper for a triple
-/// string; the constructor does not change or normalize the triple string.
-/// Clients that need to handle the non-canonical triples that users often
-/// specify should use the normalize method.
-///
-/// See autoconf/config.guess for a glimpse into what configuration names
-/// look like in practice.
-class Triple {
-public:
-  enum ArchType {
-    UnknownArch,
-
-    arm,            // ARM (little endian): arm, armv.*, xscale
-    armeb,          // ARM (big endian): armeb
-    aarch64,        // AArch64 (little endian): aarch64
-    aarch64_be,     // AArch64 (big endian): aarch64_be
-    aarch64_32,     // AArch64 (little endian) ILP32: aarch64_32
-    arc,            // ARC: Synopsys ARC
-    avr,            // AVR: Atmel AVR microcontroller
-    bpfel,          // eBPF or extended BPF or 64-bit BPF (little endian)
-    bpfeb,          // eBPF or extended BPF or 64-bit BPF (big endian)
-    csky,           // CSKY: csky
-    dxil,           // DXIL 32-bit DirectX bytecode
-    hexagon,        // Hexagon: hexagon
-    loongarch32,    // LoongArch (32-bit): loongarch32
-    loongarch64,    // LoongArch (64-bit): loongarch64
-    m68k,           // M68k: Motorola 680x0 family
-    mips,           // MIPS: mips, mipsallegrex, mipsr6
-    mipsel,         // MIPSEL: mipsel, mipsallegrexe, mipsr6el
-    mips64,         // MIPS64: mips64, mips64r6, mipsn32, mipsn32r6
-    mips64el,       // MIPS64EL: mips64el, mips64r6el, mipsn32el, mipsn32r6el
-    msp430,         // MSP430: msp430
-    ppc,            // PPC: powerpc
-    ppcle,          // PPCLE: powerpc (little endian)
-    ppc64,          // PPC64: powerpc64, ppu
-    ppc64le,        // PPC64LE: powerpc64le
-    r600,           // R600: AMD GPUs HD2XXX - HD6XXX
-    amdgcn,         // AMDGCN: AMD GCN GPUs
-    riscv32,        // RISC-V (32-bit): riscv32
-    riscv64,        // RISC-V (64-bit): riscv64
-    sparc,          // Sparc: sparc
-    sparcv9,        // Sparcv9: Sparcv9
-    sparcel,        // Sparc: (endianness = little). NB: 'Sparcle' is a CPU variant
-    systemz,        // SystemZ: s390x
-    tce,            // TCE (http://tce.cs.tut.fi/): tce
-    tcele,          // TCE little endian (http://tce.cs.tut.fi/): tcele
-    thumb,          // Thumb (little endian): thumb, thumbv.*
-    thumbeb,        // Thumb (big endian): thumbeb
-    x86,            // X86: i[3-9]86
-    x86_64,         // X86-64: amd64, x86_64
-    xcore,          // XCore: xcore
-    nvptx,          // NVPTX: 32-bit
-    nvptx64,        // NVPTX: 64-bit
-    le32,           // le32: generic little-endian 32-bit CPU (PNaCl)
-    le64,           // le64: generic little-endian 64-bit CPU (PNaCl)
-    amdil,          // AMDIL
-    amdil64,        // AMDIL with 64-bit pointers
-    hsail,          // AMD HSAIL
-    hsail64,        // AMD HSAIL with 64-bit pointers
-    spir,           // SPIR: standard portable IR for OpenCL 32-bit version
-    spir64,         // SPIR: standard portable IR for OpenCL 64-bit version
-    spirv32,        // SPIR-V with 32-bit pointers
-    spirv64,        // SPIR-V with 64-bit pointers
-    kalimba,        // Kalimba: generic kalimba
-    shave,          // SHAVE: Movidius vector VLIW processors
-    lanai,          // Lanai: Lanai 32-bit
-    wasm32,         // WebAssembly with 32-bit pointers
-    wasm64,         // WebAssembly with 64-bit pointers
-    renderscript32, // 32-bit RenderScript
-    renderscript64, // 64-bit RenderScript
-    ve,             // NEC SX-Aurora Vector Engine
-    LastArchType = ve
-  };
-  enum SubArchType {
-    NoSubArch,
-
-    ARMSubArch_v9_4a,
-    ARMSubArch_v9_3a,
-    ARMSubArch_v9_2a,
-    ARMSubArch_v9_1a,
-    ARMSubArch_v9,
-    ARMSubArch_v8_9a,
-    ARMSubArch_v8_8a,
-    ARMSubArch_v8_7a,
-    ARMSubArch_v8_6a,
-    ARMSubArch_v8_5a,
-    ARMSubArch_v8_4a,
-    ARMSubArch_v8_3a,
-    ARMSubArch_v8_2a,
-    ARMSubArch_v8_1a,
-    ARMSubArch_v8,
-    ARMSubArch_v8r,
-    ARMSubArch_v8m_baseline,
-    ARMSubArch_v8m_mainline,
-    ARMSubArch_v8_1m_mainline,
-    ARMSubArch_v7,
-    ARMSubArch_v7em,
-    ARMSubArch_v7m,
-    ARMSubArch_v7s,
-    ARMSubArch_v7k,
-    ARMSubArch_v7ve,
-    ARMSubArch_v6,
-    ARMSubArch_v6m,
-    ARMSubArch_v6k,
-    ARMSubArch_v6t2,
-    ARMSubArch_v5,
-    ARMSubArch_v5te,
-    ARMSubArch_v4t,
-
-    AArch64SubArch_arm64e,
-    AArch64SubArch_arm64ec,
-
-    KalimbaSubArch_v3,
-    KalimbaSubArch_v4,
-    KalimbaSubArch_v5,
-
-    MipsSubArch_r6,
-
-    PPCSubArch_spe,
-
-    // SPIR-V sub-arch corresponds to its version.
-    SPIRVSubArch_v10,
-    SPIRVSubArch_v11,
-    SPIRVSubArch_v12,
-    SPIRVSubArch_v13,
-    SPIRVSubArch_v14,
-    SPIRVSubArch_v15,
-  };
-  enum VendorType {
-    UnknownVendor,
-
-    Apple,
-    PC,
-    SCEI,
-    Freescale,
-    IBM,
-    ImaginationTechnologies,
-    MipsTechnologies,
-    NVIDIA,
-    CSR,
-    Myriad,
-    AMD,
-    Mesa,
-    SUSE,
-    OpenEmbedded,
-    LastVendorType = OpenEmbedded
-  };
-  enum OSType {
-    UnknownOS,
-
-    Ananas,
-    CloudABI,
-    Darwin,
-    DragonFly,
-    FreeBSD,
-    Fuchsia,
-    IOS,
-    KFreeBSD,
-    Linux,
-    Lv2,        // PS3
-    MacOSX,
-    NetBSD,
-    OpenBSD,
-    Solaris,
-    Win32,
-    ZOS,
-    Haiku,
-    Minix,
-    RTEMS,
-    NaCl,       // Native Client
-    AIX,
-    CUDA,       // NVIDIA CUDA
-    NVCL,       // NVIDIA OpenCL
-    AMDHSA,     // AMD HSA Runtime
-    PS4,
-    PS5,
-    ELFIAMCU,
-    TvOS,       // Apple tvOS
-    WatchOS,    // Apple watchOS
-    DriverKit,  // Apple DriverKit
-    Mesa3D,
-    Contiki,
-    AMDPAL,     // AMD PAL Runtime
-    HermitCore, // HermitCore Unikernel/Multikernel
-    Hurd,       // GNU/Hurd
-    WASI,       // Experimental WebAssembly OS
-    Emscripten,
-    ShaderModel, // DirectX ShaderModel
-    LastOSType = ShaderModel
-  };
-  enum EnvironmentType {
-    UnknownEnvironment,
-
-    GNU,
-    GNUABIN32,
-    GNUABI64,
-    GNUEABI,
-    GNUEABIHF,
-    GNUF32,
-    GNUF64,
-    GNUSF,
-    GNUX32,
-    GNUILP32,
-    CODE16,
-    EABI,
-    EABIHF,
-    Android,
-    Musl,
-    MuslEABI,
-    MuslEABIHF,
-    MuslX32,
-
-    MSVC,
-    Itanium,
-    Cygnus,
-    CoreCLR,
-    Simulator, // Simulator variants of other systems, e.g., Apple's iOS
-    MacABI, // Mac Catalyst variant of Apple's iOS deployment target.
-    
-    // Shader Stages
-    // The order of these values matters, and must be kept in sync with the
-    // language options enum in Clang. The ordering is enforced in
-    // static_asserts in Triple.cpp and in Clang.
-    Pixel,
-    Vertex,
-    Geometry,
-    Hull,
-    Domain,
-    Compute,
-    Library,
-    RayGeneration,
-    Intersection,
-    AnyHit,
-    ClosestHit,
-    Miss,
-    Callable,
-    Mesh,
-    Amplification,
-
-    LastEnvironmentType = Amplification
-  };
-  enum ObjectFormatType {
-    UnknownObjectFormat,
-
-    COFF,
-    DXContainer,
-    ELF,
-    GOFF,
-    MachO,
-    SPIRV,
-    Wasm,
-    XCOFF,
-  };
-
-private:
-  std::string Data;
-
-  /// The parsed arch type.
-  ArchType Arch{};
-
-  /// The parsed subarchitecture type.
-  SubArchType SubArch{};
-
-  /// The parsed vendor type.
-  VendorType Vendor{};
-
-  /// The parsed OS type.
-  OSType OS{};
-
-  /// The parsed Environment type.
-  EnvironmentType Environment{};
-
-  /// The object format type.
-  ObjectFormatType ObjectFormat{};
-
-public:
-  /// @name Constructors
-  /// @{
-
-  /// Default constructor is the same as an empty string and leaves all
-  /// triple fields unknown.
-  Triple() = default;
-
-  explicit Triple(const Twine &Str);
-  Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
-  Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
-         const Twine &EnvironmentStr);
-
-  bool operator==(const Triple &Other) const {
-    return Arch == Other.Arch && SubArch == Other.SubArch &&
-           Vendor == Other.Vendor && OS == Other.OS &&
-           Environment == Other.Environment &&
-           ObjectFormat == Other.ObjectFormat;
-  }
-
-  bool operator!=(const Triple &Other) const {
-    return !(*this == Other);
-  }
-
-  /// @}
-  /// @name Normalization
-  /// @{
-
-  /// Turn an arbitrary machine specification into the canonical triple form (or
-  /// something sensible that the Triple class understands if nothing better can
-  /// reasonably be done).  In particular, it handles the common case in which
-  /// otherwise valid components are in the wrong order.
-  static std::string normalize(StringRef Str);
-
-  /// Return the normalized form of this triple's string.
-  std::string normalize() const { return normalize(Data); }
-
-  /// @}
-  /// @name Typed Component Access
-  /// @{
-
-  /// Get the parsed architecture type of this triple.
-  ArchType getArch() const { return Arch; }
-
-  /// get the parsed subarchitecture type for this triple.
-  SubArchType getSubArch() const { return SubArch; }
-
-  /// Get the parsed vendor type of this triple.
-  VendorType getVendor() const { return Vendor; }
-
-  /// Get the parsed operating system type of this triple.
-  OSType getOS() const { return OS; }
-
-  /// Does this triple have the optional environment (fourth) component?
-  bool hasEnvironment() const {
-    return getEnvironmentName() != "";
-  }
-
-  /// Get the parsed environment type of this triple.
-  EnvironmentType getEnvironment() const { return Environment; }
-
-  /// Parse the version number from the OS name component of the
-  /// triple, if present.
-  ///
-  /// For example, "fooos1.2.3" would return (1, 2, 3).
-  VersionTuple getEnvironmentVersion() const;
-
-  /// Get the object format for this triple.
-  ObjectFormatType getObjectFormat() const { return ObjectFormat; }
-
-  /// Parse the version number from the OS name component of the triple, if
-  /// present.
-  ///
-  /// For example, "fooos1.2.3" would return (1, 2, 3).
-  VersionTuple getOSVersion() const;
-
-  /// Return just the major version number, this is specialized because it is a
-  /// common query.
-  unsigned getOSMajorVersion() const { return getOSVersion().getMajor(); }
-
-  /// Parse the version number as with getOSVersion and then translate generic
-  /// "darwin" versions to the corresponding OS X versions.  This may also be
-  /// called with IOS triples but the OS X version number is just set to a
-  /// constant 10.4.0 in that case.  Returns true if successful.
-  bool getMacOSXVersion(VersionTuple &Version) const;
-
-  /// Parse the version number as with getOSVersion.  This should only be called
-  /// with IOS or generic triples.
-  VersionTuple getiOSVersion() const;
-
-  /// Parse the version number as with getOSVersion.  This should only be called
-  /// with WatchOS or generic triples.
-  VersionTuple getWatchOSVersion() const;
-
-  /// Parse the version number as with getOSVersion.
-  VersionTuple getDriverKitVersion() const;
-
-  /// @}
-  /// @name Direct Component Access
-  /// @{
-
-  const std::string &str() const { return Data; }
-
-  const std::string &getTriple() const { return Data; }
-
-  /// Get the architecture (first) component of the triple.
-  StringRef getArchName() const;
-
-  /// Get the architecture name based on Kind and SubArch.
-  StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch) const;
-
-  /// Get the vendor (second) component of the triple.
-  StringRef getVendorName() const;
-
-  /// Get the operating system (third) component of the triple.
-  StringRef getOSName() const;
-
-  /// Get the optional environment (fourth) component of the triple, or "" if
-  /// empty.
-  StringRef getEnvironmentName() const;
-
-  /// Get the operating system and optional environment components as a single
-  /// string (separated by a '-' if the environment component is present).
-  StringRef getOSAndEnvironmentName() const;
-
-  /// @}
-  /// @name Convenience Predicates
-  /// @{
-
-  /// Test whether the architecture is 64-bit
-  ///
-  /// Note that this tests for 64-bit pointer width, and nothing else. Note
-  /// that we intentionally expose only three predicates, 64-bit, 32-bit, and
-  /// 16-bit. The inner details of pointer width for particular architectures
-  /// is not summed up in the triple, and so only a coarse grained predicate
-  /// system is provided.
-  bool isArch64Bit() const;
-
-  /// Test whether the architecture is 32-bit
-  ///
-  /// Note that this tests for 32-bit pointer width, and nothing else.
-  bool isArch32Bit() const;
-
-  /// Test whether the architecture is 16-bit
-  ///
-  /// Note that this tests for 16-bit pointer width, and nothing else.
-  bool isArch16Bit() const;
-
-  /// Helper function for doing comparisons against version numbers included in
-  /// the target triple.
-  bool isOSVersionLT(unsigned Major, unsigned Minor = 0,
-                     unsigned Micro = 0) const {
-    if (Minor == 0) {
-      return getOSVersion() < VersionTuple(Major);
-    }
-    if (Micro == 0) {
-      return getOSVersion() < VersionTuple(Major, Minor);
-    }
-    return getOSVersion() < VersionTuple(Major, Minor, Micro);
-  }
-
-  bool isOSVersionLT(const Triple &Other) const {
-    return getOSVersion() < Other.getOSVersion();
-  }
-
-  /// Comparison function for checking OS X version compatibility, which handles
-  /// supporting skewed version numbering schemes used by the "darwin" triples.
-  bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
-                         unsigned Micro = 0) const;
-
-  /// Is this a Mac OS X triple. For legacy reasons, we support both "darwin"
-  /// and "osx" as OS X triples.
-  bool isMacOSX() const {
-    return getOS() == Triple::Darwin || getOS() == Triple::MacOSX;
-  }
-
-  /// Is this an iOS triple.
-  /// Note: This identifies tvOS as a variant of iOS. If that ever
-  /// changes, i.e., if the two operating systems diverge or their version
-  /// numbers get out of sync, that will need to be changed.
-  /// watchOS has completely different version numbers so it is not included.
-  bool isiOS() const {
-    return getOS() == Triple::IOS || isTvOS();
-  }
-
-  /// Is this an Apple tvOS triple.
-  bool isTvOS() const {
-    return getOS() == Triple::TvOS;
-  }
-
-  /// Is this an Apple watchOS triple.
-  bool isWatchOS() const {
-    return getOS() == Triple::WatchOS;
-  }
-
-  bool isWatchABI() const {
-    return getSubArch() == Triple::ARMSubArch_v7k;
-  }
-
-  /// Is this an Apple DriverKit triple.
-  bool isDriverKit() const { return getOS() == Triple::DriverKit; }
-
-  bool isOSzOS() const { return getOS() == Triple::ZOS; }
-
-  /// Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, or DriverKit).
-  bool isOSDarwin() const {
-    return isMacOSX() || isiOS() || isWatchOS() || isDriverKit();
-  }
-
-  bool isSimulatorEnvironment() const {
-    return getEnvironment() == Triple::Simulator;
-  }
-
-  bool isMacCatalystEnvironment() const {
-    return getEnvironment() == Triple::MacABI;
-  }
-
-  /// Returns true for targets that run on a macOS machine.
-  bool isTargetMachineMac() const {
-    return isMacOSX() || (isOSDarwin() && (isSimulatorEnvironment() ||
-                                           isMacCatalystEnvironment()));
-  }
-
-  bool isOSNetBSD() const {
-    return getOS() == Triple::NetBSD;
-  }
-
-  bool isOSOpenBSD() const {
-    return getOS() == Triple::OpenBSD;
-  }
-
-  bool isOSFreeBSD() const {
-    return getOS() == Triple::FreeBSD;
-  }
-
-  bool isOSFuchsia() const {
-    return getOS() == Triple::Fuchsia;
-  }
-
-  bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
-
-  bool isOSSolaris() const {
-    return getOS() == Triple::Solaris;
-  }
-
-  bool isOSIAMCU() const {
-    return getOS() == Triple::ELFIAMCU;
-  }
-
-  bool isOSUnknown() const { return getOS() == Triple::UnknownOS; }
-
-  bool isGNUEnvironment() const {
-    EnvironmentType Env = getEnvironment();
-    return Env == Triple::GNU || Env == Triple::GNUABIN32 ||
-           Env == Triple::GNUABI64 || Env == Triple::GNUEABI ||
-           Env == Triple::GNUEABIHF || Env == Triple::GNUF32 ||
-           Env == Triple::GNUF64 || Env == Triple::GNUSF ||
-           Env == Triple::GNUX32;
-  }
-
-  bool isOSContiki() const {
-    return getOS() == Triple::Contiki;
-  }
-
-  /// Tests whether the OS is Haiku.
-  bool isOSHaiku() const {
-    return getOS() == Triple::Haiku;
-  }
-
-  /// Tests whether the OS is Windows.
-  bool isOSWindows() const {
-    return getOS() == Triple::Win32;
-  }
-
-  /// Checks if the environment is MSVC.
-  bool isKnownWindowsMSVCEnvironment() const {
-    return isOSWindows() && getEnvironment() == Triple::MSVC;
-  }
-
-  /// Checks if the environment could be MSVC.
-  bool isWindowsMSVCEnvironment() const {
-    return isKnownWindowsMSVCEnvironment() ||
-           (isOSWindows() && getEnvironment() == Triple::UnknownEnvironment);
-  }
-
-  // Checks if we're using the Windows Arm64EC ABI.
-  bool isWindowsArm64EC() const {
-    return getArch() == Triple::aarch64 &&
-           getSubArch() == Triple::AArch64SubArch_arm64ec;
-  }
-
-  bool isWindowsCoreCLREnvironment() const {
-    return isOSWindows() && getEnvironment() == Triple::CoreCLR;
-  }
-
-  bool isWindowsItaniumEnvironment() const {
-    return isOSWindows() && getEnvironment() == Triple::Itanium;
-  }
-
-  bool isWindowsCygwinEnvironment() const {
-    return isOSWindows() && getEnvironment() == Triple::Cygnus;
-  }
-
-  bool isWindowsGNUEnvironment() const {
-    return isOSWindows() && getEnvironment() == Triple::GNU;
-  }
-
-  /// Tests for either Cygwin or MinGW OS
-  bool isOSCygMing() const {
-    return isWindowsCygwinEnvironment() || isWindowsGNUEnvironment();
-  }
-
-  /// Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
-  bool isOSMSVCRT() const {
-    return isWindowsMSVCEnvironment() || isWindowsGNUEnvironment() ||
-           isWindowsItaniumEnvironment();
-  }
-
-  /// Tests whether the OS is NaCl (Native Client)
-  bool isOSNaCl() const {
-    return getOS() == Triple::NaCl;
-  }
-
-  /// Tests whether the OS is Linux.
-  bool isOSLinux() const {
-    return getOS() == Triple::Linux;
-  }
-
-  /// Tests whether the OS is kFreeBSD.
-  bool isOSKFreeBSD() const {
-    return getOS() == Triple::KFreeBSD;
-  }
-
-  /// Tests whether the OS is Hurd.
-  bool isOSHurd() const {
-    return getOS() == Triple::Hurd;
-  }
-
-  /// Tests whether the OS is WASI.
-  bool isOSWASI() const {
-    return getOS() == Triple::WASI;
-  }
-
-  /// Tests whether the OS is Emscripten.
-  bool isOSEmscripten() const {
-    return getOS() == Triple::Emscripten;
-  }
-
-  /// Tests whether the OS uses glibc.
-  bool isOSGlibc() const {
-    return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD ||
-            getOS() == Triple::Hurd) &&
-           !isAndroid();
-  }
-
-  /// Tests whether the OS is AIX.
-  bool isOSAIX() const {
-    return getOS() == Triple::AIX;
-  }
-
-  /// Tests whether the OS uses the ELF binary format.
-  bool isOSBinFormatELF() const {
-    return getObjectFormat() == Triple::ELF;
-  }
-
-  /// Tests whether the OS uses the COFF binary format.
-  bool isOSBinFormatCOFF() const {
-    return getObjectFormat() == Triple::COFF;
-  }
-
-  /// Tests whether the OS uses the GOFF binary format.
-  bool isOSBinFormatGOFF() const { return getObjectFormat() == Triple::GOFF; }
-
-  /// Tests whether the environment is MachO.
-  bool isOSBinFormatMachO() const {
-    return getObjectFormat() == Triple::MachO;
-  }
-
-  /// Tests whether the OS uses the Wasm binary format.
-  bool isOSBinFormatWasm() const {
-    return getObjectFormat() == Triple::Wasm;
-  }
-
-  /// Tests whether the OS uses the XCOFF binary format.
-  bool isOSBinFormatXCOFF() const {
-    return getObjectFormat() == Triple::XCOFF;
-  }
-
-  /// Tests whether the OS uses the DXContainer binary format.
-  bool isOSBinFormatDXContainer() const {
-    return getObjectFormat() == Triple::DXContainer;
-  }
-
-  /// Tests whether the target is the PS4 platform.
-  bool isPS4() const {
-    return getArch() == Triple::x86_64 &&
-           getVendor() == Triple::SCEI &&
-           getOS() == Triple::PS4;
-  }
-
-  /// Tests whether the target is the PS5 platform.
-  bool isPS5() const {
-    return getArch() == Triple::x86_64 &&
-      getVendor() == Triple::SCEI &&
-      getOS() == Triple::PS5;
-  }
-
-  /// Tests whether the target is the PS4 or PS5 platform.
-  bool isPS() const { return isPS4() || isPS5(); }
-
-  /// Tests whether the target is Android
-  bool isAndroid() const { return getEnvironment() == Triple::Android; }
-
-  bool isAndroidVersionLT(unsigned Major) const {
-    assert(isAndroid() && "Not an Android triple!");
-
-    VersionTuple Version = getEnvironmentVersion();
-
-    // 64-bit targets did not exist before API level 21 (Lollipop).
-    if (isArch64Bit() && Version.getMajor() < 21)
-      return VersionTuple(21) < VersionTuple(Major);
-
-    return Version < VersionTuple(Major);
-  }
-
-  /// Tests whether the environment is musl-libc
-  bool isMusl() const {
-    return getEnvironment() == Triple::Musl ||
-           getEnvironment() == Triple::MuslEABI ||
-           getEnvironment() == Triple::MuslEABIHF ||
-           getEnvironment() == Triple::MuslX32;
-  }
-
-  /// Tests whether the target is DXIL.
-  bool isDXIL() const {
-    return getArch() == Triple::dxil;
-  }
-
-  /// Tests whether the target is SPIR (32- or 64-bit).
-  bool isSPIR() const {
-    return getArch() == Triple::spir || getArch() == Triple::spir64;
-  }
-
-  /// Tests whether the target is SPIR-V (32/64-bit).
-  bool isSPIRV() const {
-    return getArch() == Triple::spirv32 || getArch() == Triple::spirv64;
-  }
-
-  /// Tests whether the target is NVPTX (32- or 64-bit).
-  bool isNVPTX() const {
-    return getArch() == Triple::nvptx || getArch() == Triple::nvptx64;
-  }
-
-  /// Tests whether the target is AMDGCN
-  bool isAMDGCN() const { return getArch() == Triple::amdgcn; }
-
-  bool isAMDGPU() const {
-    return getArch() == Triple::r600 || getArch() == Triple::amdgcn;
-  }
-
-  /// Tests whether the target is Thumb (little and big endian).
-  bool isThumb() const {
-    return getArch() == Triple::thumb || getArch() == Triple::thumbeb;
-  }
-
-  /// Tests whether the target is ARM (little and big endian).
-  bool isARM() const {
-    return getArch() == Triple::arm || getArch() == Triple::armeb;
-  }
-
-  /// Tests whether the target supports the EHABI exception
-  /// handling standard.
-  bool isTargetEHABICompatible() const {
-    return (isARM() || isThumb()) &&
-           (getEnvironment() == Triple::EABI ||
-            getEnvironment() == Triple::GNUEABI ||
-            getEnvironment() == Triple::MuslEABI ||
-            getEnvironment() == Triple::EABIHF ||
-            getEnvironment() == Triple::GNUEABIHF ||
-            getEnvironment() == Triple::MuslEABIHF || isAndroid()) &&
-           isOSBinFormatELF();
-  }
-
-  /// Tests whether the target is T32.
-  bool isArmT32() const {
-    switch (getSubArch()) {
-    case Triple::ARMSubArch_v8m_baseline:
-    case Triple::ARMSubArch_v7s:
-    case Triple::ARMSubArch_v7k:
-    case Triple::ARMSubArch_v7ve:
-    case Triple::ARMSubArch_v6:
-    case Triple::ARMSubArch_v6m:
-    case Triple::ARMSubArch_v6k:
-    case Triple::ARMSubArch_v6t2:
-    case Triple::ARMSubArch_v5:
-    case Triple::ARMSubArch_v5te:
-    case Triple::ARMSubArch_v4t:
-      return false;
-    default:
-      return true;
-    }
-  }
-
-  /// Tests whether the target is an M-class.
-  bool isArmMClass() const {
-    switch (getSubArch()) {
-    case Triple::ARMSubArch_v6m:
-    case Triple::ARMSubArch_v7m:
-    case Triple::ARMSubArch_v7em:
-    case Triple::ARMSubArch_v8m_mainline:
-    case Triple::ARMSubArch_v8m_baseline:
-    case Triple::ARMSubArch_v8_1m_mainline:
-      return true;
-    default:
-      return false;
-    }
-  }
-
-  /// Tests whether the target is AArch64 (little and big endian).
-  bool isAArch64() const {
-    return getArch() == Triple::aarch64 || getArch() == Triple::aarch64_be ||
-           getArch() == Triple::aarch64_32;
-  }
-
-  /// Tests whether the target is AArch64 and pointers are the size specified by
-  /// \p PointerWidth.
-  bool isAArch64(int PointerWidth) const {
-    assert(PointerWidth == 64 || PointerWidth == 32);
-    if (!isAArch64())
-      return false;
-    return getArch() == Triple::aarch64_32 ||
-                   getEnvironment() == Triple::GNUILP32
-               ? PointerWidth == 32
-               : PointerWidth == 64;
-  }
-
-  /// Tests whether the target is LoongArch (32- and 64-bit).
-  bool isLoongArch() const {
-    return getArch() == Triple::loongarch32 || getArch() == Triple::loongarch64;
-  }
-
-  /// Tests whether the target is MIPS 32-bit (little and big endian).
-  bool isMIPS32() const {
-    return getArch() == Triple::mips || getArch() == Triple::mipsel;
-  }
-
-  /// Tests whether the target is MIPS 64-bit (little and big endian).
-  bool isMIPS64() const {
-    return getArch() == Triple::mips64 || getArch() == Triple::mips64el;
-  }
-
-  /// Tests whether the target is MIPS (little and big endian, 32- or 64-bit).
-  bool isMIPS() const {
-    return isMIPS32() || isMIPS64();
-  }
-
-  /// Tests whether the target is PowerPC (32- or 64-bit LE or BE).
-  bool isPPC() const {
-    return getArch() == Triple::ppc || getArch() == Triple::ppc64 ||
-           getArch() == Triple::ppcle || getArch() == Triple::ppc64le;
-  }
-
-  /// Tests whether the target is 32-bit PowerPC (little and big endian).
-  bool isPPC32() const {
-    return getArch() == Triple::ppc || getArch() == Triple::ppcle;
-  }
-
-  /// Tests whether the target is 64-bit PowerPC (little and big endian).
-  bool isPPC64() const {
-    return getArch() == Triple::ppc64 || getArch() == Triple::ppc64le;
-  }
-
-  /// Tests whether the target is 32-bit RISC-V.
-  bool isRISCV32() const { return getArch() == Triple::riscv32; }
-
-  /// Tests whether the target is 64-bit RISC-V.
-  bool isRISCV64() const { return getArch() == Triple::riscv64; }
-
-  /// Tests whether the target is RISC-V (32- and 64-bit).
-  bool isRISCV() const { return isRISCV32() || isRISCV64(); }
-
-  /// Tests whether the target is 32-bit SPARC (little and big endian).
-  bool isSPARC32() const {
-    return getArch() == Triple::sparc || getArch() == Triple::sparcel;
-  }
-
-  /// Tests whether the target is 64-bit SPARC (big endian).
-  bool isSPARC64() const { return getArch() == Triple::sparcv9; }
-
-  /// Tests whether the target is SPARC.
-  bool isSPARC() const { return isSPARC32() || isSPARC64(); }
-
-  /// Tests whether the target is SystemZ.
-  bool isSystemZ() const {
-    return getArch() == Triple::systemz;
-  }
-
-  /// Tests whether the target is x86 (32- or 64-bit).
-  bool isX86() const {
-    return getArch() == Triple::x86 || getArch() == Triple::x86_64;
-  }
-
-  /// Tests whether the target is VE
-  bool isVE() const {
-    return getArch() == Triple::ve;
-  }
-
-  /// Tests whether the target is wasm (32- and 64-bit).
-  bool isWasm() const {
-    return getArch() == Triple::wasm32 || getArch() == Triple::wasm64;
-  }
-
-  // Tests whether the target is CSKY
-  bool isCSKY() const {
-    return getArch() == Triple::csky;
-  }
-
-  /// Tests whether the target is the Apple "arm64e" AArch64 subarch.
-  bool isArm64e() const {
-    return getArch() == Triple::aarch64 &&
-           getSubArch() == Triple::AArch64SubArch_arm64e;
-  }
-
-  /// Tests whether the target is X32.
-  bool isX32() const {
-    EnvironmentType Env = getEnvironment();
-    return Env == Triple::GNUX32 || Env == Triple::MuslX32;
-  }
-
-  /// Tests whether the target supports comdat
-  bool supportsCOMDAT() const {
-    return !(isOSBinFormatMachO() || isOSBinFormatXCOFF() ||
-             isOSBinFormatDXContainer());
-  }
-
-  /// Tests whether the target uses emulated TLS as default.
-  bool hasDefaultEmulatedTLS() const {
-    return isAndroid() || isOSOpenBSD() || isWindowsCygwinEnvironment();
-  }
-
-  /// Tests whether the target uses -data-sections as default.
-  bool hasDefaultDataSections() const {
-    return isOSBinFormatXCOFF() || isWasm();
-  }
-
-  /// Tests if the environment supports dllimport/export annotations.
-  bool hasDLLImportExport() const { return isOSWindows() || isPS(); }
-
-  /// @}
-  /// @name Mutators
-  /// @{
-
-  /// Set the architecture (first) component of the triple to a known type.
-  void setArch(ArchType Kind, SubArchType SubArch = NoSubArch);
-
-  /// Set the vendor (second) component of the triple to a known type.
-  void setVendor(VendorType Kind);
-
-  /// Set the operating system (third) component of the triple to a known type.
-  void setOS(OSType Kind);
-
-  /// Set the environment (fourth) component of the triple to a known type.
-  void setEnvironment(EnvironmentType Kind);
-
-  /// Set the object file format.
-  void setObjectFormat(ObjectFormatType Kind);
-
-  /// Set all components to the new triple \p Str.
-  void setTriple(const Twine &Str);
-
-  /// Set the architecture (first) component of the triple by name.
-  void setArchName(StringRef Str);
-
-  /// Set the vendor (second) component of the triple by name.
-  void setVendorName(StringRef Str);
-
-  /// Set the operating system (third) component of the triple by name.
-  void setOSName(StringRef Str);
-
-  /// Set the optional environment (fourth) component of the triple by name.
-  void setEnvironmentName(StringRef Str);
-
-  /// Set the operating system and optional environment components with a single
-  /// string.
-  void setOSAndEnvironmentName(StringRef Str);
-
-  /// @}
-  /// @name Helpers to build variants of a particular triple.
-  /// @{
-
-  /// Form a triple with a 32-bit variant of the current architecture.
-  ///
-  /// This can be used to move across "families" of architectures where useful.
-  ///
-  /// \returns A new triple with a 32-bit architecture or an unknown
-  ///          architecture if no such variant can be found.
-  llvm::Triple get32BitArchVariant() const;
-
-  /// Form a triple with a 64-bit variant of the current architecture.
-  ///
-  /// This can be used to move across "families" of architectures where useful.
-  ///
-  /// \returns A new triple with a 64-bit architecture or an unknown
-  ///          architecture if no such variant can be found.
-  llvm::Triple get64BitArchVariant() const;
-
-  /// Form a triple with a big endian variant of the current architecture.
-  ///
-  /// This can be used to move across "families" of architectures where useful.
-  ///
-  /// \returns A new triple with a big endian architecture or an unknown
-  ///          architecture if no such variant can be found.
-  llvm::Triple getBigEndianArchVariant() const;
-
-  /// Form a triple with a little endian variant of the current architecture.
-  ///
-  /// This can be used to move across "families" of architectures where useful.
-  ///
-  /// \returns A new triple with a little endian architecture or an unknown
-  ///          architecture if no such variant can be found.
-  llvm::Triple getLittleEndianArchVariant() const;
-
-  /// Tests whether the target triple is little endian.
-  ///
-  /// \returns true if the triple is little endian, false otherwise.
-  bool isLittleEndian() const;
-
-  /// Test whether target triples are compatible.
-  bool isCompatibleWith(const Triple &Other) const;
-
-  /// Merge target triples.
-  std::string merge(const Triple &Other) const;
-
-  /// Some platforms have different minimum supported OS versions that
-  /// varies by the architecture specified in the triple. This function
-  /// returns the minimum supported OS version for this triple if one an exists,
-  /// or an invalid version tuple if this triple doesn't have one.
-  VersionTuple getMinimumSupportedOSVersion() const;
-
-  /// @}
-  /// @name Static helpers for IDs.
-  /// @{
-
-  /// Get the canonical name for the \p Kind architecture.
-  static StringRef getArchTypeName(ArchType Kind);
-
-  /// Get the "prefix" canonical name for the \p Kind architecture. This is the
-  /// prefix used by the architecture specific builtins, and is suitable for
-  /// passing to \see Intrinsic::getIntrinsicForClangBuiltin().
-  ///
-  /// \return - The architecture prefix, or 0 if none is defined.
-  static StringRef getArchTypePrefix(ArchType Kind);
-
-  /// Get the canonical name for the \p Kind vendor.
-  static StringRef getVendorTypeName(VendorType Kind);
-
-  /// Get the canonical name for the \p Kind operating system.
-  static StringRef getOSTypeName(OSType Kind);
-
-  /// Get the canonical name for the \p Kind environment.
-  static StringRef getEnvironmentTypeName(EnvironmentType Kind);
-
-  /// @}
-  /// @name Static helpers for converting alternate architecture names.
-  /// @{
-
-  /// The canonical type for the given LLVM architecture name (e.g., "x86").
-  static ArchType getArchTypeForLLVMName(StringRef Str);
-
-  /// @}
-
-  /// Returns a canonicalized OS version number for the specified OS.
-  static VersionTuple getCanonicalVersionForOS(OSType OSKind,
-                                               const VersionTuple &Version);
-};
-
-} // End llvm namespace
-
-
-#endif
+// llvm/ADT/Triple.h is now in llvm/TargetParser
+#include "llvm/TargetParser/Triple.h"
----------------
I think it would make sense to make it explicit in the comment that the header in `llvm/ADT/Triple.h` is deprecated.


================
Comment at: llvm/include/llvm/Support/AArch64TargetParser.h:10
+/// \file
+/// This is a forwarding header for `llvm/TargetParser/AArch64TargetParser.h`.
+///
----------------
Same here - I'd make it explicit in the comment that we are going to deprecate this header.


================
Comment at: llvm/include/llvm/Support/ARMTargetParser.h:10
+/// \file
+/// This is a forwarding header for `llvm/TargetParser/ARMTargetParser.h`.
+///
----------------
Same here, make it explicit that the header will be deprecated.


================
Comment at: llvm/include/llvm/Support/CSKYTargetParser.h:10
+/// \file
+/// This is a forwarding header for `llvm/TargetParser/CSKYTargetParser.h`.
+///
----------------
Same, explicit deprecation.


================
Comment at: llvm/include/llvm/Support/Host.h:10
+/// \file
+/// This is a forwarding header for `llvm/TargetParser/Host.h`.
+///
----------------
Explicit deprecation.


================
Comment at: llvm/include/llvm/Support/LoongArchTargetParser.h:10
+/// \file
+/// This is a forwarding header for `llvm/TargetParser/LoongArchTargetParser.h`.
+///
----------------
Same, explicit deprecation.


================
Comment at: llvm/include/llvm/Support/RISCVISAInfo.h:10
+/// \file
+/// This is a forwarding header for `llvm/Support/RISCVISAInfo.h`.
+///
----------------
Same, explicit deprecation.


================
Comment at: llvm/include/llvm/Support/TargetParser.h:14
 
-#ifndef LLVM_SUPPORT_TARGETPARSER_H
-#define LLVM_SUPPORT_TARGETPARSER_H
-
-#include "llvm/ADT/StringRef.h"
-#include <cstdint>
-// FIXME: vector is used because that's what clang uses for subtarget feature
-// lists, but SmallVector would probably be better
-#include <vector>
-
-namespace llvm {
-
-template <typename T> class SmallVectorImpl;
-class Triple;
-
-// Target specific information in their own namespaces.
-// (ARM/AArch64/X86 are declared in ARM/AArch64/X86TargetParser.h)
-// These should be generated from TableGen because the information is already
-// there, and there is where new information about targets will be added.
-// FIXME: To TableGen this we need to make some table generated files available
-// even if the back-end is not compiled with LLVM, plus we need to create a new
-// back-end to TableGen to create these clean tables.
-namespace AMDGPU {
-
-/// GPU kinds supported by the AMDGPU target.
-enum GPUKind : uint32_t {
-  // Not specified processor.
-  GK_NONE = 0,
-
-  // R600-based processors.
-  GK_R600 = 1,
-  GK_R630 = 2,
-  GK_RS880 = 3,
-  GK_RV670 = 4,
-  GK_RV710 = 5,
-  GK_RV730 = 6,
-  GK_RV770 = 7,
-  GK_CEDAR = 8,
-  GK_CYPRESS = 9,
-  GK_JUNIPER = 10,
-  GK_REDWOOD = 11,
-  GK_SUMO = 12,
-  GK_BARTS = 13,
-  GK_CAICOS = 14,
-  GK_CAYMAN = 15,
-  GK_TURKS = 16,
-
-  GK_R600_FIRST = GK_R600,
-  GK_R600_LAST = GK_TURKS,
-
-  // AMDGCN-based processors.
-  GK_GFX600 = 32,
-  GK_GFX601 = 33,
-  GK_GFX602 = 34,
-
-  GK_GFX700 = 40,
-  GK_GFX701 = 41,
-  GK_GFX702 = 42,
-  GK_GFX703 = 43,
-  GK_GFX704 = 44,
-  GK_GFX705 = 45,
-
-  GK_GFX801 = 50,
-  GK_GFX802 = 51,
-  GK_GFX803 = 52,
-  GK_GFX805 = 53,
-  GK_GFX810 = 54,
-
-  GK_GFX900 = 60,
-  GK_GFX902 = 61,
-  GK_GFX904 = 62,
-  GK_GFX906 = 63,
-  GK_GFX908 = 64,
-  GK_GFX909 = 65,
-  GK_GFX90A = 66,
-  GK_GFX90C = 67,
-  GK_GFX940 = 68,
-
-  GK_GFX1010 = 71,
-  GK_GFX1011 = 72,
-  GK_GFX1012 = 73,
-  GK_GFX1013 = 74,
-  GK_GFX1030 = 75,
-  GK_GFX1031 = 76,
-  GK_GFX1032 = 77,
-  GK_GFX1033 = 78,
-  GK_GFX1034 = 79,
-  GK_GFX1035 = 80,
-  GK_GFX1036 = 81,
-
-  GK_GFX1100 = 90,
-  GK_GFX1101 = 91,
-  GK_GFX1102 = 92,
-  GK_GFX1103 = 93,
-
-  GK_AMDGCN_FIRST = GK_GFX600,
-  GK_AMDGCN_LAST = GK_GFX1103,
-};
-
-/// Instruction set architecture version.
-struct IsaVersion {
-  unsigned Major;
-  unsigned Minor;
-  unsigned Stepping;
-};
-
-// This isn't comprehensive for now, just things that are needed from the
-// frontend driver.
-enum ArchFeatureKind : uint32_t {
-  FEATURE_NONE = 0,
-
-  // These features only exist for r600, and are implied true for amdgcn.
-  FEATURE_FMA = 1 << 1,
-  FEATURE_LDEXP = 1 << 2,
-  FEATURE_FP64 = 1 << 3,
-
-  // Common features.
-  FEATURE_FAST_FMA_F32 = 1 << 4,
-  FEATURE_FAST_DENORMAL_F32 = 1 << 5,
-
-  // Wavefront 32 is available.
-  FEATURE_WAVE32 = 1 << 6,
-
-  // Xnack is available.
-  FEATURE_XNACK = 1 << 7,
-
-  // Sram-ecc is available.
-  FEATURE_SRAMECC = 1 << 8,
-};
-
-StringRef getArchNameAMDGCN(GPUKind AK);
-StringRef getArchNameR600(GPUKind AK);
-StringRef getCanonicalArchName(const Triple &T, StringRef Arch);
-GPUKind parseArchAMDGCN(StringRef CPU);
-GPUKind parseArchR600(StringRef CPU);
-unsigned getArchAttrAMDGCN(GPUKind AK);
-unsigned getArchAttrR600(GPUKind AK);
-
-void fillValidArchListAMDGCN(SmallVectorImpl<StringRef> &Values);
-void fillValidArchListR600(SmallVectorImpl<StringRef> &Values);
-
-IsaVersion getIsaVersion(StringRef GPU);
-
-} // namespace AMDGPU
-
-namespace RISCV {
-
-// We use 64 bits as the known part in the scalable vector types.
-static constexpr unsigned RVVBitsPerBlock = 64;
-
-enum CPUKind : unsigned {
-#define PROC(ENUM, NAME, FEATURES, DEFAULT_MARCH) CK_##ENUM,
-#define TUNE_PROC(ENUM, NAME) CK_##ENUM,
-#include "RISCVTargetParser.def"
-};
-
-enum FeatureKind : unsigned {
-  FK_INVALID = 0,
-  FK_NONE = 1,
-  FK_64BIT = 1 << 2,
-};
-
-bool checkCPUKind(CPUKind Kind, bool IsRV64);
-bool checkTuneCPUKind(CPUKind Kind, bool IsRV64);
-CPUKind parseCPUKind(StringRef CPU);
-CPUKind parseTuneCPUKind(StringRef CPU, bool IsRV64);
-StringRef getMArchFromMcpu(StringRef CPU);
-void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values, bool IsRV64);
-void fillValidTuneCPUArchList(SmallVectorImpl<StringRef> &Values, bool IsRV64);
-bool getCPUFeaturesExceptStdExt(CPUKind Kind, std::vector<StringRef> &Features);
-
-} // namespace RISCV
-} // namespace llvm
-
-#endif
+#include "llvm/TargetParser/TargetParser.h"
----------------
Explicit deprecation.


================
Comment at: llvm/include/llvm/Support/X86TargetParser.def:10
+/// \file
+/// This is a forwarding header for `llvm/TargetParser/X86TargetParser.def`.
+///
----------------
Again, explicit deprecation.


================
Comment at: llvm/include/llvm/Support/X86TargetParser.h:10
+/// \file
+/// This is a forwarding header for `llvm/TargetParser/X86TargetParser.h`.
+///
----------------
Guess! Explicit deprecation!


================
Comment at: llvm/include/llvm/TargetParser/AArch64TargetParser.def:1-9
+//===- AArch64TargetParser.def - AARCH64 target parsing defines -*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
----------------
nit: The changes in this file are cosmetic and not needed as part of this change. I think you should submit them separately.


================
Comment at: llvm/include/llvm/TargetParser/ARMTargetParser.h:85
   {NAME, sizeof(NAME) - 1, ID, FEATURE, NEGFEATURE},
-#include "ARMTargetParser.def"
+#include "llvm/TargetParser/ARMTargetParser.def"
 };
----------------
II don't think this change is needed? AFAIU, the code will compile anyway even without it because the current folder is the folder where the compiler first looks for include headers?

I think you should revert this one (and the similar changes below).

If there is a real need to change it, you can do it with a new separate submission.


================
Comment at: llvm/include/llvm/TargetParser/CSKYTargetParser.h:129
   {NAME, sizeof(NAME) - 1, ID, FEATURE, NEGFEATURE},
-#include "CSKYTargetParser.def"
+#include "llvm/TargetParser/CSKYTargetParser.def"
 };
----------------
Nit: like before, this change doesn't seem to be needed.


================
Comment at: llvm/lib/TargetParser/AArch64TargetParser.cpp:136
 
-  for (const auto &Alias: AArch64CPUAliases)
+  for (const auto &Alias : AArch64CPUAliases)
     Values.push_back(Alias.getAlias());
----------------
nit: unrelated.


================
Comment at: llvm/lib/TargetParser/ARMTargetParser.cpp:160-186
+      // We have to specify the + and - versions of the name in full so
+      // that we can return them as static StringRefs.
+      //
+      // Also, the SubtargetFeatures ending in just "sp" are listed here
+      // under FPURestriction::None, which is the only FPURestriction in
+      // which they would be valid (since FPURestriction::SP doesn't
+      // exist).
----------------
Tabs? Unrelated.


================
Comment at: llvm/lib/TargetParser/ARMTargetParser.cpp:189
 
-  for (const auto &Info: FPUFeatureInfoList) {
+  for (const auto &Info : FPUFeatureInfoList) {
     if (FPUNames[FPUKind].FPUVer >= Info.MinVersion &&
----------------
nit: unrelated


================
Comment at: llvm/lib/TargetParser/ARMTargetParser.cpp:206
 
-  for (const auto &Info: NeonFeatureInfoList) {
+  for (const auto &Info : NeonFeatureInfoList) {
     if (FPUNames[FPUKind].NeonSupport >= Info.MinSupportLevel)
----------------
nit: unrelated


================
Comment at: llvm/lib/TargetParser/Unix/Host.inc:24-26
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
----------------
Why is the guard needed?


================
Comment at: llvm/unittests/Support/CMakeLists.txt:3
   Support
+  TargetParser
   )
----------------
Is this needed? The tests for TargetParser should not be here anymore, no?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137838/new/

https://reviews.llvm.org/D137838



More information about the libc-commits mailing list