1511 Commits

Author SHA1 Message Date
Ami-zhang
f5f3612453
[clang][LoongArch] Add OHOS target (#127555)
Add support for OHOS on loongarch64.
2025-03-03 09:25:49 +08:00
Brad Smith
4294fe173e
[Driver][FreeBSD] Remove FreeBSD/loongarch32 support (#122515)
FreeBSD going forward will not have 32-bit arch support.

Also missed a spot with removing riscv32 support.
2025-01-19 22:23:11 -05:00
Ian Anderson
8a1174f06c
[Darwin][Driver][clang] arm64-apple-none-macho is missing the Apple macros from arm-apple-none-macho (#122427)
arm-apple-none-macho uses DarwinTargetInfo which provides several Apple
specific macros. arm64-apple-none-macho however just uses the generic
AArch64leTargetInfo and doesn't get any of those macros. It's not clear
if everything from DarwinTargetInfo is desirable for
arm64-apple-none-macho, so make an AppleMachOTargetInfo to hold the
generic Apple macros and a few other basic things.
2025-01-10 15:50:54 -08:00
Brad Smith
d2498afccb
[Driver][NFC] Formatting fixes (#122519) 2025-01-10 15:01:32 -05:00
Alexey Gerenkov
2d6e7c2b35
[Clang][Xtensa] Add Xtensa target. (#118008)
This PR implements support for generic Xtensa target in CLang.

Co-authored-by: Andrei Safronov <safronov@espressif.com>
2024-12-25 09:56:15 +01:00
Hervé Poussineau
970f65a98a
[Clang][MIPS] Create specific targets for MIPS PE/COFF (#121040)
Implement GNU and MSVC variants.
When using them, _WIN32 and _M_MRX000/_MIPS_ macros are correctly
defined.
2024-12-25 09:26:31 +08:00
hitmoon
3b10e31d3a
[clang][LoongArch] Add FreeBSD targets (#119191)
Add support for freebsd on loongarch

Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
Co-authored-by: yu shan wei <mpysw@vip.163.com>
2024-12-13 10:34:53 +08:00
Aaron Ballman
af7c58b7ea
Remove support for RenderScript (#112916)
See
https://discourse.llvm.org/t/rfc-deprecate-and-eventually-remove-renderscript-support/81284
for the RFC
2024-10-28 12:48:42 -04:00
Prabhuk
fb78495376
Reland "[Driver] Add toolchain for X86_64 UEFI target" (#109364)
Reverts llvm/llvm-project#109340

Addressing the failed MAC Clang Driver test as part of this reland.
2024-09-20 11:16:36 -07:00
Prabhuk
d2df2e41ca
Revert "[Driver] Add toolchain for X86_64 UEFI target" (#109340)
Reverts llvm/llvm-project#76838

Appears to be causing failures in MAC builders. First reverting the
patch and will investigate after.
2024-09-19 15:28:07 -07:00
Prabhuk
d1335fb864
[Driver] Add toolchain for X86_64 UEFI target (#76838)
Introduce changes necessary for UEFI X86_64 target Clang driver.
Addressed the review comments originally suggested in Phabricator.

Differential Revision: https://reviews.llvm.org/D159541
2024-09-19 11:46:55 -07:00
Aaron Ballman
617cf8a72d
Reapply "Finish deleting the le32/le64 targets" (#99079) (#101983)
This reverts commit d3f8105c65046173e20c4c59394b4a7f1bbe7627.

Halide no longer relies on this target:
https://github.com/llvm/llvm-project/pull/98497#issuecomment-2253358685
2024-08-06 08:35:56 -04:00
Aaron Ballman
d3f8105c65
Revert "Finish deleting the le32/le64 targets" (#99079)
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-16 14:47:09 -04:00
Aaron Ballman
2369a54fbe
Finish deleting the le32/le64 targets (#98497)
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-07-12 06:55:49 -04:00
Alex Voicu
88e2bb4092
[clang][SPIR-V] Add support for AMDGCN flavoured SPIRV (#89796)
This change seeks to add support for vendor flavoured SPIRV - more
specifically, AMDGCN flavoured SPIRV. The aim is to generate SPIRV that
carries some extra bits of information that are only usable by AMDGCN
targets, forfeiting absolute genericity to obtain greater expressiveness
for target features:

- AMDGCN inline ASM is allowed/supported, under the assumption that the
[SPV_INTEL_inline_assembly](https://github.com/intel/llvm/blob/sycl/sycl/doc/design/spirv-extensions/SPV_INTEL_inline_assembly.asciidoc)
extension is enabled/used
- AMDGCN target specific builtins are allowed/supported, under the
assumption that e.g. the `--spirv-allow-unknown-intrinsics` option is
enabled when using the downstream translator
- the featureset matches the union of AMDGCN targets' features
- the datalayout string is overspecified to affix both the program
address space and the alloca address space, the latter under the
assumption that the
[SPV_INTEL_function_pointers](https://github.com/intel/llvm/blob/sycl/sycl/doc/design/spirv-extensions/SPV_INTEL_function_pointers.asciidoc)
extension is enabled/used, case in which the extant SPIRV datalayout
string would lead to pointers to function pointing to the private
address space, which would be wrong.

Existing AMDGCN tests are extended to cover this new target. It is
currently dormant / will require some additional changes, but I thought
I'd rather put it up for review to get feedback as early as possible. I
will note that an alternative option is to place this under AMDGPU, but
that seems slightly less natural, since this is still SPIRV, albeit
relaxed in terms of preconditions & constrained in terms of
postconditions, and only guaranteed to be usable on AMDGCN targets (it
is still possible to obtain pristine portable SPIRV through usage of the
flavoured target, though).
2024-06-07 11:50:23 +01:00
S. Bharadwaj Yadavalli
6d8901488f
[DXIL] Set DXIL Version in DXIL target triple based on shader model version (#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 12:20:41 -04:00
S. Bharadwaj Yadavalli
178ff39500
Revert "[DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version" (#91290)
Reverts llvm/llvm-project#90809

Need to investigate ASAN failures.
2024-05-06 22:21:37 -04:00
S. Bharadwaj Yadavalli
080978dd20
[DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model 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-06 18:33:57 -04:00
Prabhuk
ea9ec80b7a
Revert "[AArch64] Add soft-float ABI (#74460)" (#82032)
This reverts commit 9cc98e336980f00cbafcbed8841344e6ac472bdc.

Issue: https://github.com/ClangBuiltLinux/linux/issues/1997
2024-02-16 16:43:50 -08:00
ostannard
9cc98e3369
[AArch64] Add soft-float ABI (#74460)
This adds support for the AArch64 soft-float ABI. The specification for
this ABI was added by https://github.com/ARM-software/abi-aa/pull/232.

Because all existing AArch64 hardware has floating-point hardware, we
expect this to be a niche option, only used for embedded systems on
R-profile systems. We are going to document that SysV-like systems
should only ever use the base (hard-float) PCS variant:
https://github.com/ARM-software/abi-aa/pull/233. For that reason, I've
not added an option to select the ABI independently of the FPU hardware,
instead the new ABI is enabled iff the target architecture does not have
an FPU.

For testing, I have run this through an ABI fuzzer, but since this is
the first implementation it can only test for internal consistency
(callers and callees agree on the PCS), not for conformance to the ABI
spec.
2024-02-15 12:39:16 +00:00
Samuel Thibault
4fffb0401b
Hurd: Add x86_64 support (#78065)
This adds Hurd toolchain support to Clang's driver in addition to
handling
translating the triple from GCC toolchain-compatible form (x86_64-gnu)
to
the actual triple registered in LLVM (x86_64-pc-hurd-gnu).
2024-01-17 14:38:40 -08:00
Brad Smith
15254eb740
[Driver] Clean up unused architecture related bits for *BSD's (#69809)
- FreeBSD removed big-endian arm with 12.0.
- OpenBSD never had big-endian arm support. I added it just in case, but it has
  never been used.
- Remove sparcel bits. It was sprinkled in a few places but it will never be a
  thing.
- Remove 32-bit sparc bits for FreeBSD. FreeBSD has never had 32-bit sparc
  support.
- Remove sparc64 IAS test as support was enabled across the board awhile ago.
2023-10-26 14:44:12 -04:00
Brad Smith
7cfe32d4d8
[Driver] Hook up Haiku ARM support (#67222) 2023-10-09 00:49:53 -04:00
Brad Smith
c1300efc78
[Driver] Remove FreeBSD/riscv32 support (#67277)
FreeBSD does not support riscv32 and has no intention of doing so.
2023-09-25 09:43:10 -04:00
Brad Smith
62ffbe0dcc
[Driver] Hook up NetBSD/riscv support (#67256) 2023-09-24 16:29:46 -04:00
Nathan Gauër
53b6a169e4 [SPIR-V] Add SPIR-V logical triple.
Clang implements SPIR-V with both Physical32 and Physical64 addressing
models. This commit adds a new triple value for the Logical
addressing model.

Differential Revision: https://reviews.llvm.org/D155978
2023-09-11 10:15:24 +02:00
Brad Smith
6081d3342d Fix indenting after Haiku addition 2023-09-02 06:27:36 -04:00
Brad Smith
561d3076aa Hook up Haiku AArch64 and RISCV64 support 2023-09-02 03:17:16 -04:00
Brad Smith
5165593a97 Delete CloudABI support
After this D108637 and with FreeBSD -current and now 14 dropping support for
CloudABI I think it is time to consider deleting the CloudABI support.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D158920
2023-08-29 22:57:30 -04:00
Brad Smith
2a105105a6 Delete Ananas support
After looking at this further I think the Ananas support should be removed.

They stopped using Clang. There have never been any releases either; as in
source only, and the backend is not maintained.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D158946
2023-08-27 18:43:23 -04:00
Fangrui Song
3515409012 [Driver] Remove unlikely-working Minix.cpp and Contiki.cpp
Minix is a ToolChain that was added back in 2010 but has been
unmaintained with no test. The constructed command line contains
/usr/gnu/include/c++/4.4.3 and CompilerRT-Generic which are unlikely
working for a long time.

Contiki is a barebone ToolChain that just enables safestack.
This doesn't justify a new ToolChain.

Remove these ToolChains so that their target triples will use Generic_ELF instead.

If these developers feel like having an updated llvm-project is useful,
fixing other build issues and adding a new ToolChain is much better than
having the unmaintained ToolChains.

Reviewed By: brad

Differential Revision: https://reviews.llvm.org/D158461
2023-08-23 23:58:38 -07:00
Yaxun (Sam) Liu
c8c5830715 Fix diag for read-only target features
Currently the diag is emitted even when there is no
target feature specified on command line for OpenMP.
This is because the function to initialize feature map
is also used with cached feature string. The fix is to
only diag when the feature map is initialized with
feature strings from command line options.

Reviewed by: Joseph Huber, Matt Arsenault, Johannes Doerfert

Differential Revision: https://reviews.llvm.org/D153123
2023-06-16 17:48:27 -04:00
Stoorx
830b359d3a [clang] Return std::unique_ptr<TargetInfo> from AllocateTarget
In file 'clang/lib/Basic/Targets.cpp' the function 'AllocateTarget' had a raw pointer as a return type, which have been wrapped in the 'std::unique_ptr' in all usages.
This commit changes the signature of the function to return an instance of 'std::unique_ptr' directly.

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D148574
2023-04-18 10:07:26 +00:00
David Tenty
2fe49ea0d0 [clang][PowerPC] Remove remaining Darwin support
POWER Darwin support in the backend has been removed for some time: https://discourse.llvm.org/t/rfc-remove-darwin-support-from-power-backends
but Clang still has the TargetInfo and other remnants lying around.

This patch does some cleanup and removes those and other related frontend support still remaining. We adjust any tests using the triple to either remove
the test if unneeded or switch to another Power triple.

Reviewed By: MaskRay, nemanjai

Differential Revision: https://reviews.llvm.org/D146459
2023-03-28 17:12:49 -04:00
Pavel Kosov
28997feb0c [LLVM][OHOS] Clang toolchain and targets
Add a clang part of OpenHarmony target

Related LLVM part: D138202

~~~

Huawei RRI, OS Lab

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D145227
2023-03-20 12:53:24 +03:00
Daniel Thornburgh
d505d20a62 Revert "[LLVM][OHOS] Clang toolchain and targets"
This change had tests that break whenever LLVM_ENABLE_LINKER_BUILD_ID is
set, as is the case in the Fuchsia target.

This reverts commits:
f81317a54586dbcef0c14cf512a0770e8ecaab3d
72474afa27570a0a1307f3260f0187b703aa6d84
2023-03-14 13:46:21 -07:00
Pavel Kosov
72474afa27 [LLVM][OHOS] Clang toolchain and targets
Add a clang part of OpenHarmony target

Related LLVM part: D138202

~~~

Huawei RRI, OS Lab

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D145227
2023-03-14 12:24:44 +03:00
Archibald Elliott
62c7f035b4 [NFC][TargetParser] Remove llvm/ADT/Triple.h
I also ran `git clang-format` to get the headers in the right order for
the new location, which has changed the order of other headers in two
files.
2023-02-07 12:39:46 +00:00
Alvin Wong
d90633a74b [Clang][MinGW][cygwin] Fix __declspec with -fdeclspec enabled
Fixes https://github.com/llvm/llvm-project/issues/49958

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D135027
2022-10-03 10:58:45 +03:00
Weining Lu
15b65bcd65 [Clang][LoongArch] Add initial LoongArch target and driver support
With the initial support added, clang can compile `helloworld` C
to executable file for loongarch64. For example:

```
$ cat hello.c
int main() {
  printf("Hello, world!\n");
  return 0;
}
$ clang --target=loongarch64-unknown-linux-gnu --gcc-toolchain=xxx --sysroot=xxx hello.c
```

The output a.out can run within qemu or native machine. For example:

```
$ file ./a.out
./a.out: ELF 64-bit LSB pie executable, LoongArch, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-loongarch-lp64d.so.1, for GNU/Linux 5.19.0, with debug_info, not stripped
$ ./a.out
Hello, world!
```

Currently gcc toolchain and sysroot can be found here:
https://github.com/loongson/build-tools/releases/download/2022.08.11/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz

Reference: https://github.com/loongson/LoongArch-Documentation
The last commit hash (main branch) is:
99016636af64d02dee05e39974d4c1e55875c45b

Note loongarch32 is not fully tested because there is no reference
gcc toolchain yet.

Differential Revision: https://reviews.llvm.org/D130255
2022-08-23 13:47:22 +08:00
Paul Robinson
8869ba3662 [PS5] Add PS5OSTargetInfo class, update affected tests 2022-06-01 13:30:29 -07:00
Zi Xuan Wu
97e496054a [Clang][CSKY] Add the CSKY target and compiler driver
Add CSKY target toolchains to support csky in linux and elf environment.

It can leverage the basic universal Linux toolchain for linux environment, and only add some compile or link parameters.
For elf environment, add a CSKYToolChain to support compile and link.

Also add some parameters into basic codebase of clang driver.

Differential Revision: https://reviews.llvm.org/D121445
2022-04-06 11:37:37 +08:00
Chris Bieneman
c5e54e2752 Add clang DirectX target support
This change adds a stub DirectX target for clang to enable targeting
dxil targets.

Reviewed By: pete

Differential Revision: https://reviews.llvm.org/D122085
2022-03-28 15:00:50 -05:00
Alex Lorenz
116c1bea65 [clang][macho] add clang frontend support for emitting macho files with two build version load commands
This patch extends clang frontend to add metadata that can be used to emit macho files with two build version load commands.
It utilizes "darwin.target_variant.triple" and "darwin.target_variant.SDK Version" metadata names for that.

MachO uses two build version load commands to represent an object file / binary that is targeting both the macOS target,
and the Mac Catalyst target. At runtime, a dynamic library that supports both targets can be loaded from either a native
macOS or a Mac Catalyst app on a macOS system. We want to add support to this to upstream to LLVM to be able to build
compiler-rt for both targets, to finish the complete support for the Mac Catalyst platform, which is right now targetable
by upstream clang, but the compiler-rt bits aren't supported because of the lack of this multiple build version support.

Differential Revision: https://reviews.llvm.org/D115415
2022-02-02 08:30:39 -08:00
Anastasia Stulova
a10a69fe9c [SPIR-V] Add SPIR-V triple and clang target info.
Add new triple and target info for ‘spirv32’ and ‘spirv64’ and,
thus, enabling clang (LLVM IR) code emission to SPIR-V target.

The target for SPIR-V is mostly reused from SPIR by derivation
from a common base class since IR output for SPIR-V is mostly
the same as SPIR. Some refactoring are made accordingly.

Added and updated tests for parts that are different between
SPIR and SPIR-V.

Patch by linjamaki (Henry Linjamäki)!

Differential Revision: https://reviews.llvm.org/D109144
2021-11-08 13:34:10 +00:00
Justas Janickas
f9bc1b3bee [OpenCL] Defines helper function for kernel language compatible OpenCL version
This change defines a helper function getOpenCLCompatibleVersion()
inside LangOptions class. The function contains mapping between
C++ for OpenCL versions and their corresponding compatible OpenCL
versions. This mapping function should be updated each time a new
C++ for OpenCL language version is introduced. The helper function
is expected to simplify conditions on OpenCL C and C++ for OpenCL
versions inside compiler code.

Code refactoring performed.

Differential Revision: https://reviews.llvm.org/D108693
2021-08-31 10:08:38 +01:00
Anton Zabaznov
ab76101f40 [OpenCL] Add support of __opencl_c_read_write_images feature macro
This feature requires support of __opencl_c_images, so diagnostics for that is provided as well

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D104915
2021-07-13 15:38:23 +03:00
Anton Zabaznov
826905787a [OpenCL] Add support of OpenCL C 3.0 __opencl_c_fp64
There already exists cl_khr_fp64 extension. So OpenCL C 3.0
and higher should use the feature, earlier versions still
use the extension. OpenCL C 3.0 API spec states that extension
will be not described in the option string if corresponding
optional functionality is not supported (see 4.2. Querying Devices).
Due to that fact the usage of features for OpenCL C 3.0 must
be as follows:

```
$ clang -Xclang -cl-ext=+cl_khr_fp64,+__opencl_c_fp64 ...

$ clang -Xclang -cl-ext=-cl_khr_fp64,-__opencl_c_fp64 ...
```

e.g. the feature and the equivalent extension (if exists)
must be set to the same values

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D96524
2021-05-21 15:01:19 +03:00
Anton Zabaznov
f0efc00751 [OpenCL] Introduce new method for validating OpenCL target
Language options are not available when a target is being created,
thus, a new method is introduced. Also, some refactoring is done,
such as removing OpenCL feature macros setting from TargetInfo.

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D101087
2021-04-28 16:00:02 +03:00
Fangrui Song
ef5e7f90ea Temporarily revert the code part of D100981 "Delete le32/le64 targets"
This partially reverts commit 77ac823fd285973cfb3517932c09d82e6a32f46d.

Halide uses le32/le64 (https://github.com/halide/Halide/pull/5934).
Temporarily brings back the code part to give them some time for migration.
2021-04-22 10:18:44 -07:00