summaryrefslogtreecommitdiff
path: root/llvm/lib/TargetParser/Triple.cpp
AgeCommit message (Collapse)Author
2025-10-23[ARM][AArch64] Introduce the Armv9.7-A architecture version (#163154)Jonathan Thackray
This introduces the Armv9.7-A architecture version, including the relevant command-line option for -march. More details about the Armv9.7-A architecture version can be found at: * https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/arm-a-profile-architecture-developments-2025 * https://developer.arm.com/documentation/109697/2025_09/2025-Architecture-Extensions * https://developer.arm.com/documentation/ddi0602/2025-09/ Co-authored-by: Caroline Concatto <caroline.concatto@arm.com>
2025-10-15[ADT] Migrate StringSwitch Cases with 6+ arguments to new overload. NFC. ↵Jakub Kuderski
(#163549) Switch to the `.Cases({S0, S1, ...}, Value)` overload instead, and the manually-enumerated overloads with 6+ arguments are getting deprecated in https://github.com/llvm/llvm-project/pull/163405. This pre-commits API updates ahead of the deprecation to make potential reverts cleaner. This was already reviewed in #163405.
2025-10-10[WebAssembly] Support for new target `wasm32-linux-muslwali` (#162581)Arjun Ramesh
Add toolchain support for the [WALI](https://doc.rust-lang.org/rustc/platform-support/wasm32-wali-linux.html) target as per its corresponding [RFC](https://discourse.llvm.org/t/rfc-new-wasm-linux-target-support/88203)
2025-09-19Revert "[ELF][LLDB] Add an nvsass triple (#159459)" (#159879)Joseph Huber
Summary: This patch has broken the `libc` build bot. I could work around that but the changes seem unnecessary. This reverts commit 9ba844eb3a21d461c3adc7add7691a076c6992fc.
2025-09-19[ELF][LLDB] Add an nvsass triple (#159459)Walter Erquinigo
When handling CUDA ELF files via objdump or LLDB, the ELF parser in LLVM needs to distinguish if an ELF file is sass or not, which requires a triple for sass to exist in llvm. This patch includes all the necessary changes for LLDB and objdump to correctly identify these files with the correct triple.
2025-09-09[HLSL][DirectX] Add support for `rootsig` as a target environment (#156373)Finn Plummer
This pr implements support for a root signature as a target, as specified [here](https://github.com/llvm/wg-hlsl/blob/main/proposals/0029-root-signature-driver-options.md#target-root-signature-version). This is implemented in the following steps: 1. Add `rootsignature` as a shader model environment type and define `rootsig` as a `target_profile`. Only valid as versions 1.0 and 1.1 2. Updates `HLSLFrontendAction` to invoke a special handling of constructing the `ASTContext` if we are considering an `hlsl` file and with a `rootsignature` target 3. Defines the special handling to minimally instantiate the `Parser` and `Sema` to insert the `RootSignatureDecl` 4. Updates `CGHLSLRuntime` to emit the constructed root signature decl as part of `dx.rootsignatures` with a `null` entry function 5. Updates `DXILRootSignature` to handle emitting a root signature without an entry function 6. Updates `ToolChains/HLSL` to invoke `only-section=RTS0` to strip any other generated information Resolves: https://github.com/llvm/llvm-project/issues/150286. ##### Implementation Considerations Ideally we could invoke this as part of `clang-dxc` without the need of a source file. However, the initialization of the `Parser` and `Lexer` becomes quite complicated to handle this. Technically, we could avoid generating any of the extra information that is removed in step 6. However, it seems better to re-use the logic in `llvm-objcopy` without any need for additional custom logic in `DXILRootSignature`.
2025-09-05[DirectX] Add isinf f16 emulation for SM6.8 and lower (#156932)Farzon Lotfi
fixes #156068 - We needed to add a new sub arch to the target tripple so we can test that emulation does not happen when targeting SM6.9 - The HLSL toolchain needed to be updated to handle the conversion of strings to enums for the new sub arch. - The emulation is done in DXILIntrinsicExpansion.cpp and needs to be able to convert both llvm.is.fpclass and lvm.dx.isinf to the proper emulation - test updates in TargetParser/TripleTest.cpp, isinf.ll, is_fpclass.ll, and DXCModeTest.cpp
2025-09-02[Triple] Add target triple support for CheriotRTOS. (#155374)Owen Anderson
For context, CheriotRTOS is a custom RTOS co-designed for the CHERIoT CHERI-enabled RISCV32E platform. It uses a custom ABI and linkage model, necesitating representing it in the target triple.
2025-07-28Add MTIA and META to triple (#150236)satyanarayana reddy janga
Ref: https://ai.meta.com/blog/next-generation-meta-training-inference-accelerator-AI-MTIA/ This PR contains 1. MTIA: Meta Training and Inference Accelerator as Environment. 2. Meta as the vendor. ### Testing Added a unittest for the relevant changes ### Reviewers @clayborg , @jeffreytan81 , @Jlalond
2025-07-23[llvm] Remove unused includes (NFC) (#150265)Kazu Hirata
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-07-17[llvm-objcopy][libObject] Add RISC-V big-endian support (#146913)Djordje Todorovic
Add support for big-endian RISC-V ELF files: - Add riscv32be/riscv64be target architectures to Triple - Support elf32-bigriscv and elf64-bigriscv output targets in llvm-objcopy - Update ELFObjectFile to handle BE RISC-V format strings and architecture detection - Add BE RISC-V support to RelocationResolver - Add tests for new functionality This is a subset of a bigger RISC-V big-endian support patch, containing only the llvm-objcopy and libObject changes. Other changes will be added later.
2025-07-15Remove Native Client support (#133661)Brad Smith
Remove the Native Client support now that it has finally reached end of life.
2025-07-08[Triple][M68k] Add missing handling for target m68k in ↵Jim Lin
getDefaultExceptionHandling. (#147492) I encountered the assertion failure `Assertion TmpAsmInfo->getExceptionHandlingType() == getTargetTriple().getDefaultExceptionHandling() && "MCAsmInfo and Triple disagree on default exception handling type"' failed`.
2025-07-08Triple: Record default exception handling typeMatt Arsenault
Currently the default exception handling type is scattered across the backends in MCAsmInfo constructors. Allow this to be computed from the triple so the IR can centrally determine the set of ABI calls. Manually submitting, closes #147225
2025-06-26Triple: Forward declare Twine and remove include (#145685)Matt Arsenault
2025-06-25Triple: Remove workaround for gcc 4.0.3 (#145660)Matt Arsenault
Use the Twine version instead of manually building a string
2025-06-25Triple: Remove redundant member initializers (#145661)Matt Arsenault
These are already initialized in the field definitions.
2025-06-11[AArch64] fix trampoline implementation: use X15 (#126743)Jameson Nash
AAPCS64 reserves any of X9-X15 for a compiler to choose to use for this purpose, and says not to use X16 or X18 like GCC (and the previous implementation) chose to use. The X18 register may need to get used by the kernel in some circumstances, as specified by the platform ABI, so it is generally an unwise choice. Simply choosing a different register fixes the problem of this being broken on any platform that actually follows the platform ABI (which is all of them except EABI, if I am reading this linux kernel bug correctly https://lkml2.uits.iu.edu/hypermail/linux/kernel/2001.2/01502.html). As a side benefit, also generate slightly better code and avoids needing the compiler-rt to be present. I did that by following the XCore implementation instead of PPC (although in hindsight, following the RISCV might have been slightly more readable). That X18 is wrong to use for this purpose has been known for many years (e.g. https://www.mail-archive.com/gcc@gcc.gnu.org/msg76934.html) and also known that fixing this to use one of the correct registers is not an ABI break, since this only appears inside of a translation unit. Some of the other temporary registers (e.g. X9) are already reserved inside llvm for internal use as a generic temporary register in the prologue before saving registers, while X15 was already used in rare cases as a scratch register in the prologue as well, so I felt that seemed the most logical choice to choose here.
2025-06-10[clang][Darwin] Align all OS Versions for 26 (#143548)Cyndy Ishida
* Translate the following versions to 26. * watchOS 12 -> 26 * visionOS 3 -> 26 * macos 16 -> 26 * iOS 19 -> 26 * tvOS 19 -> 26 * Emit diagnostics, but allow conversion when clients attempt to use invalid gaps in OS versioning in availability. * For target-triples, only allow "valid" versions for implicit conversions.
2025-05-06[llvm] Add triples for managarm (#87845)no92
This PR aims to add a target for [managarm](https://github.com/managarm/managarm). The targets `{x86_64,aarch64,riscv64}-pc-managarm-{kernel,mlibc}` will be supported. Discourse RFC: [discourse.llvm.org/t/rfc-new-proposed-managarm-support-for-llvm-and-clang-87845/85884](https://discourse.llvm.org/t/rfc-new-proposed-managarm-support-for-llvm-and-clang-87845/85884)
2025-04-24[LLVM][TargetParser] Handle -msys targets the same as -cygwin. (#136817)jeremyd2019
MSYS2 uses i686-pc-msys and x86_64-pc-msys as target, and is a fork of Cygwin. There's an effort underway to try to switch as much as possible to use -pc-cygwin targets, but the -msys target will be hanging around for the forseeable future.
2025-01-27[Flang] Adjust the trampoline size for AArch64 and PPC (#118678)ssijaric-nv
Set the trampoline size to match that in compiler-rt/lib/builtins/trampoline_setup.c and AArch64 and PPC lowering.
2025-01-14[LLVM][Triple] Add an argument to specify canonical form to ↵Shilei Tian
`Triple::normalize` (#122935) Currently, the output of `Triple::normalize` can vary depending on how the `Triple` object is constructed, producing a 3-field, 4-field, or even 5-field string. However, there is no way to control the format of the output, as all forms are considered canonical according to the LangRef. This lack of control can be inconvenient when a specific format is required. To address this, this PR introduces an argument to specify the desired format (3, 4, or 5 identifiers), with the default set to none to maintain the current behavior. If the requested format requires more components than are available in the actual `Data`, `"unknown"` is appended as needed.
2025-01-15[Triple] Ignore the vendor field for MinGW, wrt LTO/IR compatibility (#122801)Martin Storsjö
For MinGW environments, the regular C/C++ toolchains usually use "w64" for the vendor field in triples, while Rust toolchains usually use "pc" in the vendor field. The differences in the vendor field have no bearing on whether the IR is compatible on this platform. (This probably goes for most other OSes as well, but limiting the scope of the change to the specific case.) Add a unit test for the isCompatibleWith, including some existing test cases found in existing tests.
2025-01-09[HLSL] Explicitly set the SPIR-V version with spv-target-env (#121961)Steven Perron
In DXC, setting the vulkan version automatically sets the target spir-v version to the maximum spir-v version that the vulkan version must support. So for Vulkan 1.2, we set the spir-v version to spirv 1.5 because every implementation of Vulkan 1.2 must support spirv 1.5, but not spir-v 1.6.
2024-12-17[LLVM] Add Intel vendor in Triple (#120250)Nick Sarnie
We plan to make use of this in SPIR-V-based OpenMP offloading, for which there is already an initial patch in review. Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
2024-11-21[LLVM] Add environment triple for 'llvm' (#117218)Joseph Huber
Summary: The LLVM C library is an in-development environment for running executables on various systems. Similarly how we have `-gnu` to indicate that we are using a GNU toolchain we should support `-llvm` to indicate the LLVM C library. This patch only adds the basic support for the triple and does not do any necessary clang changes to handle compiling with it. Fixes https://github.com/llvm/llvm-project/issues/117251
2024-10-15[Triple] Make mipsel-*-windows-* use COFF files by default (#107809)hpoussin
Windows NT/MIPS and Windows CE/MIPS always used COFF format. This is an extract of PR #107744.
2024-10-14[LLVM] [Clang] Support for Gentoo `*t64` triples (64-bit time_t ABIs) (#111302)Michał Górny
Gentoo is planning to introduce a `*t64` suffix for triples that will be used by 32-bit platforms that use 64-bit `time_t`. Add support for parsing and accepting these triples, and while at it make clang automatically enable the necessary glibc feature macros when this suffix is used. An open question is whether we can backport this to LLVM 19.x. After all, adding new triplets to Triple sounds like an ABI change — though I suppose we can minimize the risk of breaking something if we move new enum values to the very end.
2024-10-04[ARM][AArch64] Introduce the Armv9.6-A architecture version (#110825)Jonathan Thackray
This introduces the Armv9.6-A architecture version, including the relevant command-line option for -march. More details about the Armv9.6-A architecture version can be found at: * https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/arm-a-profile-architecture-developments-2024 * https://developer.arm.com/documentation/ddi0602/2024-09/
2024-09-20[llvm][Triple] Add `Environment` members and parsing for glibc/musl parity. ↵Alex Rønne Petersen
(#107664) This adds support for: * `muslabin32` (MIPS N32) * `muslabi64` (MIPS N64) * `muslf32` (LoongArch ILP32F/LP64F) * `muslsf` (LoongArch ILP32S/LP64S) As we start adding glibc/musl cross-compilation support for these targets in Zig, it would make our life easier if LLVM recognized these triples. I'm hoping this'll be uncontroversial since the same has already been done for `musleabi`, `musleabihf`, and `muslx32`. I intentionally left out a musl equivalent of `gnuf64` (LoongArch ILP32D/LP64D); my understanding is that Loongson ultimately settled on simply `gnu` for this much more common case, so there doesn't *seem* to be a particularly compelling reason to add a `muslf64` that's basically deprecated on arrival. Note: I don't have commit access.
2024-08-06Reapply "Finish deleting the le32/le64 targets" (#99079) (#101983)Aaron Ballman
This reverts commit d3f8105c65046173e20c4c59394b4a7f1bbe7627. Halide no longer relies on this target: https://github.com/llvm/llvm-project/pull/98497#issuecomment-2253358685
2024-07-22[PAC][Driver] Support `pauthtest` ABI for AArch64 Linux triples (#97237)Daniil Kovalev
When `pauthtest` is either passed as environment part of AArch64 Linux triple or passed via `-mabi=`, enable the following ptrauth flags: - `intrinsics`; - `calls`; - `returns`; - `auth-traps`; - `vtable-pointer-address-discrimination`; - `vtable-pointer-type-discrimination`; - `init-fini`. Some related stuff is still subject to change, and the ABI itself might be changed, so end users are not expected to use this and the ABI name has 'test' suffix. If `-mabi=pauthtest` option is used, it's normalized to effective triple. When the environment part of the effective triple is `pauthtest`, try to use `aarch64-linux-pauthtest` as multilib directory. The following is not supported: - combination of `pauthtest` ABI with any branch protection scheme except BTI; - explicit set of environment part of the triple to a value different from `pauthtest` in combination with `-mabi=pauthtest`; - usage on non-Linux OS. --------- Co-authored-by: Anatoly Trosinenko <atrosinenko@accesssoftek.com>
2024-07-16Revert "Finish deleting the le32/le64 targets" (#99079)Aaron Ballman
Reverts llvm/llvm-project#98497 We're reverting this for approx 30 days so that the Halide project has time to transition off the target.
2024-07-12Finish deleting the le32/le64 targets (#98497)Aaron Ballman
This is a revert of ef5e7f90ea4d5063ce68b952c5de473e610afc02 which was a temporary partial revert of 77ac823fd285973cfb3517932c09d82e6a32f46d. The le32 and le64 targets are no longer necessary to retain, so this removes them entirely.
2024-05-13[DirectX] Reapply Fix DXIL part header version encoding (#91956)Xiang Li
This reapplies https://github.com/llvm/llvm-project/commit/195d8ac26d91ca798733c3a5f58d67992d43503d [DirectX] Fix DXIL part header version encoding. The endian issue was fixed by https://github.com/llvm/llvm-project/commit/f42117c8517cc928c6373bad35ebf75d94fe865b. Move MinorVersion be the lower 8 bit. Set DXIL version in DXContainerObjectWriter::writeObject. Fixes #89952
2024-05-10Revert "[DirectX] Fix DXIL part header version encoding" (#91791)Justin Bogner
Test failures on big endian bots after this change. Reverts llvm/llvm-project#91506
2024-05-10[DirectX] Fix DXIL part header version encoding (#91506)Xiang Li
Move MinorVersion be the lower 8 bit. Set DXIL version in DXContainerObjectWriter::writeObject. Fixes #89952
2024-05-08[llvm] Use StringRef::operator== instead of StringRef::equals (NFC) (#91441)Kazu Hirata
I'm planning to remove StringRef::equals in favor of StringRef::operator==. - StringRef::operator==/!= outnumber StringRef::equals by a factor of 70 under llvm/ in terms of their usage. - The elimination of StringRef::equals brings StringRef closer to std::string_view, which has operator== but not equals. - S == "foo" is more readable than S.equals("foo"), especially for !Long.Expression.equals("str") vs Long.Expression != "str".
2024-05-08[DXIL] Set DXIL Version in DXIL target triple based on shader model version ↵S. Bharadwaj Yadavalli
(#91407) This change set restores commit 080978dd2067d0c9ea7e229aa7696c2480d89ef1 that was reverted to address ASAN failures and includes a fix for the ASAN failures. Following is the description of the change: An earlier commit provided a way to decouple DXIL version from Shader Model version by representing the DXIL version as `SubArch` in the DXIL Target Triple and adding corresponding valid DXIL Arch types. This change constructs DXIL target triple with DXIL version that is deduced from Shader Model version specified in the following scenarios: 1. When compilation target profile is specified: For e.g., DXIL target triple `dxilv1.8-unknown-shader6.8-library` is constructed when `-T lib_6_8` is specified. 2. When DXIL target triple without DXIL version is specified: For e.g., DXIL target triple `dxilv1.8-pc-shadermodel6.8-library` is constructed when `-mtriple=dxil-pc-shadermodel6.8-library` is specified. Updated relevant HLSL tests that check for target triple.
2024-05-08[DirectX backend] emits metadata for DXIL version. (#88350)Xiang Li
Emit named metadata "dx.version" for DXIL version. Default to DXIL 1.0
2024-05-06Revert "[DirectX][DXIL] Set DXIL Version in DXIL target triple based on ↵S. Bharadwaj Yadavalli
shader model version" (#91290) Reverts llvm/llvm-project#90809 Need to investigate ASAN failures.
2024-05-06[DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model ↵S. Bharadwaj Yadavalli
version (#90809) An earlier commit provided a way to decouple DXIL version from Shader Model version by representing the DXIL version as `SubArch` in the DXIL Target Triple and adding corresponding valid DXIL Arch types. This change constructs DXIL target triple with DXIL version that is deduced from Shader Model version specified in the following scenarios: 1. When compilation target profile is specified: For e.g., DXIL target triple `dxilv1.8-unknown-shader6.8-library` is constructed when `-T lib_6_8` is specified. 2. When DXIL target triple without DXIL version is specified: For e.g., DXIL target triple `dxilv1.8-pc-shadermodel6.8-library` is constructed when `-mtriple=dxil-pc-shadermodel6.8-library` is specified. Updated relevant HLSL tests that check for target triple. Validated that Clang (`check-clang`) and LLVM (`check-llvm`) regression tests pass.
2024-05-02Triple::normalize: Use none as OS for XX-none-ABI (#89638)YunQiang Su
When parsing a 3-component triple, after we determine Arch and Env, if the middle component is "none", treat it as OS instead of Vendor. See: https://discourse.llvm.org/t/rfc-baremetal-target-triple-normalization/78524 Fixes: #89582.
2024-04-22[SPIR-V] Emit SPIR-V generator magic number and version (#87951)Michal Paszkowski
This patch: - Adds SPIR-V backend's registered generator magic number to the emitted binary. The magic number consists of the generator ID (43) and LLVM major version. - Adds SPIR-V version to the binary. - Allows reading the expected (maximum supported) SPIR-V version from the target triple. - Uses VersionTuple for representing versions throughout the backend's codebase. - Registers v1.6 for spirv32 and spirv64 triple. See more: https://github.com/KhronosGroup/SPIRV-Headers/commit/7d500c
2024-04-18[DXIL] Add DXIL SubArch to correspond to version number (#89125)S. Bharadwaj Yadavalli
This change is in line with similar notation in SPIRV. Decoupling version numbering of DXIL and of Shader Model is intended to enable accurate specification of DXIL features that can be targeted by different Shader Model versions.
2024-04-18[NFC] Format code of parseArch() (#89152)S. Bharadwaj Yadavalli
In preparation for a cleaner addition in a following PR.
2024-02-19[llvm] Handle BridgeOS in Triple::parseOSJonas Devlieghere
This fixes the TripleTest unit test.
2024-02-19[llvm] Upstream the BridgeOS triple enum value (NFC)Jonas Devlieghere
This upstreams the BridgeOS target triple enum value.
2024-02-17[TargetParser] Expose Triple::getArchPointerBitWidth. (#82086)Lang Hames
The getArchPointerBitWidth method provides direct access to the pointer size for arithmetic or switch statements, instead of requiring clients to use the isArch16Bit / isArch32Bit / isArch64Bit predicates.