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

Sam Elliott via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 11 06:40:57 PST 2022


lenary created this revision.
Herald added subscribers: libc-commits, Moerafaat, zero9178, Enna1, bzcheeseman, kosarev, mattd, gchakrabarti, pmatos, asb, jhenderson, ayermolo, sdasgup3, asavonic, carlosgalvezp, jeroen.dobbelaere, wenzhicui, wrengr, ormris, foad, cota, teijeong, frasercrmck, rdzhabarov, tatianashp, wenlei, ThomasRaoux, cishida, mehdi_amini, okura, msifontes, jurahul, kuter, cmtice, Kayjukh, grosul1, Joonsoo, kerbowa, liufengdb, aartbik, mgester, arpith-jacob, csigg, antiagainst, shauheen, rriddle, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, asbirlea, kadircet, jocewei, PkmX, arphaman, the_o, brucehoult, MartinMosbeck, rogfer01, steven_wu, atanasyan, edward-jones, zzheng, jrtc27, gbedwell, martong, delcypher, niosHD, sabuasal, simoncook, johnrusso, rbar, fedor.sergeev, kbarton, hiraditya, kristof.beyls, jgravelle-google, arichardson, sbc100, jvesely, nemanjai, sdardis, emaste, dylanmckay, jyknight, dschuff, arsenm, qcolombet, MatzeB.
Herald added a reviewer: bollu.
Herald added a reviewer: JDevlieghere.
Herald added a reviewer: andreadb.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a reviewer: jhenderson.
Herald added a reviewer: antiagainst.
Herald added a reviewer: aartbik.
Herald added a reviewer: MaskRay.
Herald added a reviewer: awarzynski.
Herald added a reviewer: rafauler.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a reviewer: ributzka.
Herald added a reviewer: njames93.
Herald added projects: libc-project, lld-macho, Flang, All.
Herald added a reviewer: lld-macho.
lenary requested review of this revision.
Herald added subscribers: cfe-commits, llvm-commits, lldb-commits, pcwang-thead, yota9, StephenFan, vkmr, stephenneuendorffer, nicolasvasilache, jdoerfert, aheejin, jholewinski.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a reviewer: zuban32.
Herald added a reviewer: dang.
Herald added projects: clang, LLDB, MLIR, LLVM, clang-tools-extra.

This is a fairly large changeset, but it can be broken into a few
pieces:

- `llvm/Support/*TargetParser*` are all moved from the LLVM Support component into a new LLVM Component called "TargetParser". This potentially enables using tablegen to maintain this information, as is shown in https://reviews.llvm.org/D137517. This cannot currently be done, as llvm-tblgen relies on LLVM's Support component.
- This also moves two files from Support which use and depend on information in the TargetParser:
  - `llvm/Support/Host.{h,cpp}` which contains functions for inspecting the current Host machine for info about it, primarily to support getting the host triple, but also for `-mcpu=native` support in e.g. Clang. This is fairly tightly intertwined with the information in `X86TargetParser.h`, so keeping them in the same component makes sense.
  - `llvm/ADT/Triple.h` and `llvm/Support/Triple.cpp`, which contains the target triple parser and representation. This is very intertwined with the Arm target parser, because the arm architecture version appears in canonical triples on arm platforms.
- I moved the relevant unittests to their own directory.

And so, we end up with a single component that has all the information
about the following, which to me seems like a unified component:

- Triples that LLVM Knows about
- Architecture names and CPUs that LLVM knows about
- CPU detection logic for LLVM

Given this, I have also moved `RISCVISAInfo.h` into this component, as
it seems to me to be part of that same set of functionality.

I am not 100% sold on "TargetParser" as a name, but this was the best I
could come up with. The main point in preparing this patch is so that
we can evaluate the boundaries of the new component, and whether this
split makes sense.

Depends on D137837 <https://reviews.llvm.org/D137837>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137838

Files:
  bolt/include/bolt/Core/BinaryContext.h
  bolt/include/bolt/Core/Relocation.h
  bolt/lib/Core/CMakeLists.txt
  clang-tools-extra/clang-tidy/portability/CMakeLists.txt
  clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp
  clang-tools-extra/clangd/CMakeLists.txt
  clang-tools-extra/clangd/Feature.cpp
  clang-tools-extra/modularize/CMakeLists.txt
  clang-tools-extra/modularize/CoverageChecker.h
  clang/docs/tools/clang-formatted-files.txt
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/Basic/AlignedAllocation.h
  clang/include/clang/Basic/DarwinSDKInfo.h
  clang/include/clang/Basic/LangOptions.h
  clang/include/clang/Basic/ObjCRuntime.h
  clang/include/clang/Basic/TargetCXXABI.h
  clang/include/clang/Basic/TargetID.h
  clang/include/clang/Basic/TargetInfo.h
  clang/include/clang/Driver/Distro.h
  clang/include/clang/Driver/OffloadBundler.h
  clang/include/clang/Driver/ToolChain.h
  clang/include/clang/ExtractAPI/API.h
  clang/lib/ARCMigrate/ARCMT.cpp
  clang/lib/ARCMigrate/CMakeLists.txt
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/CMakeLists.txt
  clang/lib/AST/Decl.cpp
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Basic/LangStandards.cpp
  clang/lib/Basic/TargetID.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets.cpp
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/AArch64.h
  clang/lib/Basic/Targets/AMDGPU.h
  clang/lib/Basic/Targets/ARC.h
  clang/lib/Basic/Targets/ARM.h
  clang/lib/Basic/Targets/AVR.h
  clang/lib/Basic/Targets/BPF.h
  clang/lib/Basic/Targets/CSKY.h
  clang/lib/Basic/Targets/DirectX.h
  clang/lib/Basic/Targets/Hexagon.h
  clang/lib/Basic/Targets/Lanai.h
  clang/lib/Basic/Targets/Le64.h
  clang/lib/Basic/Targets/LoongArch.cpp
  clang/lib/Basic/Targets/LoongArch.h
  clang/lib/Basic/Targets/M68k.cpp
  clang/lib/Basic/Targets/M68k.h
  clang/lib/Basic/Targets/MSP430.h
  clang/lib/Basic/Targets/Mips.h
  clang/lib/Basic/Targets/NVPTX.h
  clang/lib/Basic/Targets/PNaCl.h
  clang/lib/Basic/Targets/PPC.h
  clang/lib/Basic/Targets/RISCV.cpp
  clang/lib/Basic/Targets/RISCV.h
  clang/lib/Basic/Targets/SPIR.h
  clang/lib/Basic/Targets/Sparc.h
  clang/lib/Basic/Targets/SystemZ.h
  clang/lib/Basic/Targets/TCE.h
  clang/lib/Basic/Targets/VE.h
  clang/lib/Basic/Targets/WebAssembly.h
  clang/lib/Basic/Targets/X86.cpp
  clang/lib/Basic/Targets/X86.h
  clang/lib/Basic/Targets/XCore.h
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CMakeLists.txt
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/CrossTU/CMakeLists.txt
  clang/lib/CrossTU/CrossTranslationUnit.cpp
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Compilation.cpp
  clang/lib/Driver/Distro.cpp
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/OffloadBundler.cpp
  clang/lib/Driver/SanitizerArgs.cpp
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/AMDGPU.cpp
  clang/lib/Driver/ToolChains/AMDGPU.h
  clang/lib/Driver/ToolChains/Arch/AArch64.cpp
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  clang/lib/Driver/ToolChains/Arch/ARM.h
  clang/lib/Driver/ToolChains/Arch/CSKY.cpp
  clang/lib/Driver/ToolChains/Arch/LoongArch.cpp
  clang/lib/Driver/ToolChains/Arch/M68k.cpp
  clang/lib/Driver/ToolChains/Arch/Mips.h
  clang/lib/Driver/ToolChains/Arch/PPC.cpp
  clang/lib/Driver/ToolChains/Arch/RISCV.cpp
  clang/lib/Driver/ToolChains/Arch/Sparc.cpp
  clang/lib/Driver/ToolChains/Arch/SystemZ.cpp
  clang/lib/Driver/ToolChains/Arch/X86.cpp
  clang/lib/Driver/ToolChains/Arch/X86.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/Clang.h
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/HIPAMD.cpp
  clang/lib/Driver/ToolChains/HIPUtility.cpp
  clang/lib/Driver/ToolChains/HLSL.cpp
  clang/lib/Driver/ToolChains/MSVC.cpp
  clang/lib/Driver/ToolChains/ROCm.h
  clang/lib/Frontend/CMakeLists.txt
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
  clang/lib/Interpreter/CMakeLists.txt
  clang/lib/Interpreter/Interpreter.cpp
  clang/lib/Lex/CMakeLists.txt
  clang/lib/Lex/InitHeaderSearch.cpp
  clang/lib/Sema/CMakeLists.txt
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/CMakeLists.txt
  clang/lib/Tooling/CMakeLists.txt
  clang/lib/Tooling/CompilationDatabase.cpp
  clang/lib/Tooling/DependencyScanning/CMakeLists.txt
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
  clang/lib/Tooling/DumpTool/CMakeLists.txt
  clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
  clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp
  clang/lib/Tooling/JSONCompilationDatabase.cpp
  clang/lib/Tooling/Tooling.cpp
  clang/tools/clang-fuzzer/handle-llvm/CMakeLists.txt
  clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
  clang/tools/clang-import-test/CMakeLists.txt
  clang/tools/clang-import-test/clang-import-test.cpp
  clang/tools/clang-linker-wrapper/CMakeLists.txt
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  clang/tools/clang-linker-wrapper/OffloadWrapper.cpp
  clang/tools/clang-offload-bundler/CMakeLists.txt
  clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
  clang/tools/driver/CMakeLists.txt
  clang/tools/driver/cc1as_main.cpp
  clang/tools/driver/cc1gen_reproducer_main.cpp
  clang/tools/driver/driver.cpp
  clang/unittests/AST/CMakeLists.txt
  clang/unittests/AST/StructuralEquivalenceTest.cpp
  clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp
  clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
  clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
  clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
  clang/unittests/ASTMatchers/CMakeLists.txt
  clang/unittests/CodeGen/BufferSourceTest.cpp
  clang/unittests/CodeGen/CMakeLists.txt
  clang/unittests/CodeGen/CodeGenExternalTest.cpp
  clang/unittests/CodeGen/TestCompiler.h
  clang/unittests/Driver/CMakeLists.txt
  clang/unittests/Driver/DistroTest.cpp
  clang/unittests/Driver/SanitizerArgsTest.cpp
  clang/unittests/Frontend/CMakeLists.txt
  clang/unittests/Frontend/CompilerInvocationTest.cpp
  clang/unittests/Frontend/FrontendActionTest.cpp
  clang/unittests/Interpreter/CMakeLists.txt
  clang/unittests/Interpreter/IncrementalProcessingTest.cpp
  clang/unittests/Tooling/CMakeLists.txt
  clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaExpr.cpp
  clang/unittests/Tooling/ToolingTest.cpp
  flang/include/flang/Optimizer/Support/FIRContext.h
  flang/lib/Frontend/CMakeLists.txt
  flang/lib/Frontend/CompilerInstance.cpp
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/lib/Optimizer/CodeGen/CMakeLists.txt
  flang/lib/Optimizer/CodeGen/Target.h
  flang/lib/Optimizer/Support/CMakeLists.txt
  flang/lib/Optimizer/Support/FIRContext.cpp
  flang/tools/bbc/CMakeLists.txt
  flang/tools/bbc/bbc.cpp
  flang/tools/flang-driver/CMakeLists.txt
  flang/tools/flang-driver/driver.cpp
  flang/unittests/Frontend/CMakeLists.txt
  flang/unittests/Frontend/FrontendActionTest.cpp
  flang/unittests/Optimizer/CMakeLists.txt
  flang/unittests/Optimizer/FIRContextTest.cpp
  libc/benchmarks/CMakeLists.txt
  libc/benchmarks/LibcBenchmark.cpp
  lld/COFF/CMakeLists.txt
  lld/COFF/Driver.cpp
  lld/COFF/InputFiles.cpp
  lld/Common/CMakeLists.txt
  lld/Common/TargetOptionsCommandFlags.cpp
  lld/ELF/CMakeLists.txt
  lld/ELF/DriverUtils.cpp
  lld/MachO/CMakeLists.txt
  lld/MachO/Driver.cpp
  lld/MinGW/CMakeLists.txt
  lld/MinGW/Driver.cpp
  lld/tools/lld/CMakeLists.txt
  lld/tools/lld/lld.cpp
  lld/wasm/CMakeLists.txt
  lld/wasm/Driver.cpp
  lld/wasm/InputFiles.h
  lldb/include/lldb/Utility/ArchSpec.h
  lldb/source/Core/Address.cpp
  lldb/source/Core/CMakeLists.txt
  lldb/source/Core/Disassembler.cpp
  lldb/source/Core/FormatEntity.cpp
  lldb/source/Host/common/HostInfoBase.cpp
  lldb/source/Host/freebsd/Host.cpp
  lldb/source/Host/macosx/objcxx/CMakeLists.txt
  lldb/source/Host/macosx/objcxx/Host.mm
  lldb/source/Host/netbsd/HostNetBSD.cpp
  lldb/source/Host/openbsd/Host.cpp
  lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
  lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
  lldb/source/Plugins/ABI/AArch64/CMakeLists.txt
  lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
  lldb/source/Plugins/ABI/ARC/CMakeLists.txt
  lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
  lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
  lldb/source/Plugins/ABI/ARM/CMakeLists.txt
  lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp
  lldb/source/Plugins/ABI/Hexagon/CMakeLists.txt
  lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
  lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
  lldb/source/Plugins/ABI/Mips/CMakeLists.txt
  lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
  lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
  lldb/source/Plugins/ABI/PowerPC/CMakeLists.txt
  lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
  lldb/source/Plugins/ABI/SystemZ/CMakeLists.txt
  lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
  lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
  lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
  lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
  lldb/source/Plugins/ABI/X86/CMakeLists.txt
  lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt
  lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
  lldb/source/Plugins/DynamicLoader/Windows-DYLD/CMakeLists.txt
  lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
  lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
  lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
  lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h
  lldb/source/Plugins/ObjectFile/Breakpad/CMakeLists.txt
  lldb/source/Plugins/ObjectFile/PECOFF/CMakeLists.txt
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Plugins/Platform/FreeBSD/CMakeLists.txt
  lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
  lldb/source/Plugins/Platform/MacOSX/CMakeLists.txt
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
  lldb/source/Plugins/Process/Linux/CMakeLists.txt
  lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
  (519 more files...)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137838.474749.patch
Type: text/x-patch
Size: 412010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221111/21116833/attachment-0001.bin>


More information about the cfe-commits mailing list