[all-commits] [llvm/llvm-project] 75521b: [X32] Add Triple::isX32(), use it.

Harald van Dijk via All-commits all-commits at lists.llvm.org
Mon Jun 7 12:49:11 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 75521bd9d8d1e39b1a765a14d95c49291d2adde5
      https://github.com/llvm/llvm-project/commit/75521bd9d8d1e39b1a765a14d95c49291d2adde5
  Author: Harald van Dijk <harald at gigawatt.nl>
  Date:   2021-06-07 (Mon, 07 Jun 2021)

  Changed paths:
    M clang/lib/Basic/Targets/X86.h
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Driver/ToolChains/Gnu.cpp
    M clang/lib/Driver/ToolChains/Linux.cpp
    M clang/test/Driver/linux-cross.cpp
    M llvm/include/llvm/ADT/Triple.h
    M llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
    M llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
    M llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
    M llvm/lib/Target/X86/X86AsmPrinter.cpp
    M llvm/lib/Target/X86/X86RegisterInfo.cpp
    M llvm/lib/Target/X86/X86Subtarget.h
    M llvm/lib/Target/X86/X86TargetMachine.cpp
    M llvm/test/CodeGen/X86/x32-lea-1.ll

  Log Message:
  -----------
  [X32] Add Triple::isX32(), use it.

So far, support for x86_64-linux-gnux32 has been handled by explicit
comparisons of Triple.getEnvironment() to GNUX32. This worked as long as
x86_64-linux-gnux32 was the only X32 environment to worry about, but we
now have x86_64-linux-muslx32 as well. To support this, this change adds
an isX32() function and uses it. It replaces all checks for GNUX32 or
MuslX32 by isX32(), except for the following:

- Triple::isGNUEnvironment() and Triple::isMusl() are supposed to treat
  GNUX32 and MuslX32 differently.
- computeTargetTriple() needs to be able to transform triples to add or
  remove X32 from the environment and needs to map GNU to GNUX32, and
  Musl to MuslX32.
- getMultiarchTriple() completely lacks any Musl support and retains the
  explicit check for GNUX32 as it can only return x86_64-linux-gnux32.

Reviewed By: MaskRay

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




More information about the All-commits mailing list