[PATCH] D30372: [Driver] Consolidate tools and toolchains by target platform. (NFC)

David L. Jones via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 24 21:27:28 PST 2017


dlj created this revision.
Herald added subscribers: mgorny, nhaehnle, nemanjai, jyknight, dschuff, srhines, danalbert, jfb, emaste.
Herald added a reviewer: javed.absar.

(This is a move-only refactoring patch. There are no functionality changes.)

This patch splits apart the Clang driver's tool and toolchain implementation
files. Each target platform toolchain is moved to its own file, along with the
closest-related tools. Each target platform toolchain has separate headers and
implementation files, so the hierarchy of classes is unchanged.

There are some remaining shared free functions, mostly from Tools.cpp. Several
of these move to their own architecture-specific files, similar to r296056. Some
of them are only used by a single target platform; since the tools and
toolchains are now together, some helpers now live in a platform-specific file.
The balance are helpers related to manipulating argument lists, so they are now
in a new file pair, CommonArgs.h and .cpp.

I've tried to cluster the code logically, which is fairly straightforward for
most of the target platforms and shared architectures. I think I've made
reasonable choices for these, as well as the various shared helpers; but of
course, I'm happy to hear feedback in the review.

There are some particular things I don't like about this patch, but haven't been
able to find a better overall solution. The first is the proliferation of files:
there are several files that are tiny because the toolchain is not very
different from its base (usually the Gnu tools/toolchain). I think this is
mostly a reflection of the true complexity, though, so it may not be "fixable"
in any reasonable sense. The second thing I don't like are the includes like
"../Something.h". I've avoided this largely by clustering into the current file
structure. However, a few of these includes remain, and in those cases it
doesn't make sense to me to sink an existing file any deeper.


https://reviews.llvm.org/D30372

Files:
  lib/Driver/Arch/AArch64.cpp
  lib/Driver/Arch/ARM.cpp
  lib/Driver/Arch/Mips.cpp
  lib/Driver/Arch/PPC.cpp
  lib/Driver/Arch/Sparc.cpp
  lib/Driver/Arch/SystemZ.cpp
  lib/Driver/Arch/X86.cpp
  lib/Driver/CMakeLists.txt
  lib/Driver/CrossWindowsToolChain.cpp
  lib/Driver/Driver.cpp
  lib/Driver/MSVCToolChain.cpp
  lib/Driver/MinGWToolChain.cpp
  lib/Driver/Multilib.cpp
  lib/Driver/SanitizerArgs.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  lib/Driver/ToolChains/AMDGPU.cpp
  lib/Driver/ToolChains/AMDGPU.h
  lib/Driver/ToolChains/AVR.cpp
  lib/Driver/ToolChains/AVR.h
  lib/Driver/ToolChains/Arch/AArch64.cpp
  lib/Driver/ToolChains/Arch/AArch64.h
  lib/Driver/ToolChains/Arch/ARM.cpp
  lib/Driver/ToolChains/Arch/ARM.h
  lib/Driver/ToolChains/Arch/Mips.cpp
  lib/Driver/ToolChains/Arch/Mips.h
  lib/Driver/ToolChains/Arch/PPC.cpp
  lib/Driver/ToolChains/Arch/PPC.h
  lib/Driver/ToolChains/Arch/Sparc.cpp
  lib/Driver/ToolChains/Arch/Sparc.h
  lib/Driver/ToolChains/Arch/SystemZ.cpp
  lib/Driver/ToolChains/Arch/SystemZ.h
  lib/Driver/ToolChains/Arch/X86.cpp
  lib/Driver/ToolChains/Arch/X86.h
  lib/Driver/ToolChains/Bitrig.cpp
  lib/Driver/ToolChains/Bitrig.h
  lib/Driver/ToolChains/Clang.cpp
  lib/Driver/ToolChains/Clang.h
  lib/Driver/ToolChains/CloudABI.cpp
  lib/Driver/ToolChains/CloudABI.h
  lib/Driver/ToolChains/CommonArgs.cpp
  lib/Driver/ToolChains/CommonArgs.h
  lib/Driver/ToolChains/Contiki.cpp
  lib/Driver/ToolChains/Contiki.h
  lib/Driver/ToolChains/CrossWindows.cpp
  lib/Driver/ToolChains/CrossWindows.h
  lib/Driver/ToolChains/Cuda.cpp
  lib/Driver/ToolChains/Cuda.h
  lib/Driver/ToolChains/Darwin.cpp
  lib/Driver/ToolChains/Darwin.h
  lib/Driver/ToolChains/DragonFly.cpp
  lib/Driver/ToolChains/DragonFly.h
  lib/Driver/ToolChains/FreeBSD.cpp
  lib/Driver/ToolChains/FreeBSD.h
  lib/Driver/ToolChains/Fuchsia.cpp
  lib/Driver/ToolChains/Fuchsia.h
  lib/Driver/ToolChains/Gnu.cpp
  lib/Driver/ToolChains/Gnu.h
  lib/Driver/ToolChains/Haiku.cpp
  lib/Driver/ToolChains/Haiku.h
  lib/Driver/ToolChains/Hexagon.cpp
  lib/Driver/ToolChains/Hexagon.h
  lib/Driver/ToolChains/Lanai.h
  lib/Driver/ToolChains/Linux.cpp
  lib/Driver/ToolChains/Linux.h
  lib/Driver/ToolChains/MSVC.cpp
  lib/Driver/ToolChains/MSVC.h
  lib/Driver/ToolChains/MinGW.cpp
  lib/Driver/ToolChains/MinGW.h
  lib/Driver/ToolChains/Minix.cpp
  lib/Driver/ToolChains/Minix.h
  lib/Driver/ToolChains/Mips.cpp
  lib/Driver/ToolChains/Mips.h
  lib/Driver/ToolChains/Myriad.cpp
  lib/Driver/ToolChains/Myriad.h
  lib/Driver/ToolChains/NaCl.cpp
  lib/Driver/ToolChains/NaCl.h
  lib/Driver/ToolChains/NetBSD.cpp
  lib/Driver/ToolChains/NetBSD.h
  lib/Driver/ToolChains/OpenBSD.cpp
  lib/Driver/ToolChains/OpenBSD.h
  lib/Driver/ToolChains/PS4CPU.cpp
  lib/Driver/ToolChains/PS4CPU.h
  lib/Driver/ToolChains/Solaris.cpp
  lib/Driver/ToolChains/Solaris.h
  lib/Driver/ToolChains/TCE.cpp
  lib/Driver/ToolChains/TCE.h
  lib/Driver/ToolChains/WebAssembly.cpp
  lib/Driver/ToolChains/WebAssembly.h
  lib/Driver/ToolChains/XCore.cpp
  lib/Driver/ToolChains/XCore.h
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30372.89774.patch
Type: text/x-patch
Size: 1549736 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170225/3fd01e4a/attachment-0001.bin>


More information about the cfe-commits mailing list