[PATCH] D103777: [X32] Add Triple::isX32(), use it.

Harald van Dijk via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 6 15:41:25 PDT 2021


hvdijk created this revision.
hvdijk added reviewers: MaskRay, craig.topper.
Herald added subscribers: dexonsmith, pengfei, hiraditya, dschuff.
hvdijk requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103777

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103777.350138.patch
Type: text/x-patch
Size: 11245 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210606/1376e402/attachment-0001.bin>


More information about the cfe-commits mailing list