Commit graph

39 commits

Author SHA1 Message Date
Alex Rønne Petersen
d1d95294fd std.Target.Cpu.Arch: Remove the aarch64_32 tag.
This is a misfeature that we inherited from LLVM:

* https://reviews.llvm.org/D61259
* https://reviews.llvm.org/D61939

(`aarch64_32` and `arm64_32` are equivalent.)

I truly have no idea why this triple passed review in LLVM. It is, to date, the
*only* tag in the architecture component that is not, in fact, an architecture.
In reality, it is just an ILP32 ABI for AArch64 (*not* AArch32).

The triples that use `aarch64_32` look like `aarch64_32-apple-watchos`. Yes,
that triple is exactly what you think; it has no ABI component. They really,
seriously did this.

Since only Apple could come up with silliness like this, it should come as no
surprise that no one else uses `aarch64_32`. Later on, a GNU ILP32 ABI for
AArch64 was developed, and support was added to LLVM:

* https://reviews.llvm.org/D94143
* https://reviews.llvm.org/D104931

Here, sanity seems to have prevailed, and a triple using this ABI looks like
`aarch64-linux-gnu_ilp32` as you would expect.

As can be seen from the diffs in this commit, there was plenty of confusion
throughout the Zig codebase about what exactly `aarch64_32` was. So let's just
remove it. In its place, we'll use `aarch64-watchos-ilp32`,
`aarch64-linux-gnuilp32`, and so on. We'll then translate these appropriately
when talking to LLVM. Hence, this commit adds the `ilp32` ABI tag (we already
have `gnuilp32`).
2024-07-28 19:44:52 -07:00
Alex Rønne Petersen
be9841335e
std.Target.Os: Rename lv2 to ps3.
It is very non-obvious that this is what lv2 refers to, and we already use ps4
and ps5 to refer to the later models, so let's just be consistent.
2024-07-21 22:38:30 +02:00
Alex Rønne Petersen
84e9aec13f
std.Target: Add comments for deliberately omitted/removed LLVM tags. 2024-07-21 22:38:30 +02:00
Alex Rønne Petersen
db8bc4770c
std.Target: Remove the tce/tcele arch tags.
There is no obvious reason why this would be relevant for Zig to target. I
rather question the value of LLVM even having target triple code for this, too.

See: https://blog.llvm.org/2010/06/tce-project-co-design-of-application.html
See: https://github.com/cpc/llvmtce
2024-07-21 22:38:30 +02:00
Alex Rønne Petersen
21cc5a2044
std.Target: Remove the shave arch tag.
This was added as an architecture to LLVM's target triple parser and the Clang
driver in 2015. No backend ever materialized as far as I can see (same for GCC).
In 2016, other code referring to it started using "Myriad" instead. Ultimately,
all code related to it that isn't in the target triple parser was removed. It
seems to be a real product, just... literally no one seems to know anything
about the ISA. I figure after almost a decade with no public ISA documentation
to speak of, and no LLVM backend to reference, it's probably safe to assume that
we're not going to learn much about this ISA, making it useless for Zig.

See: 1b5767f72b
See: 84a7564b28
See: 8cfe9d8f2a
2024-07-21 22:38:30 +02:00
Alex Rønne Petersen
f1e0c35db4
std.Target: Remove hsail/hsail64 arch tags.
This seems to just be dead.

See: https://github.com/search?q=repo%3Allvm%2Fllvm-project%20hsail&type=code
See: https://github.com/HSAFoundation/HSAIL-Tools/commits/master
2024-07-21 22:38:30 +02:00
Alex Rønne Petersen
67a052df81
std.Target: Remove amdil/amdil64 arch tags.
This is really obscure and no one is 100% sure what it is. It seems to be old
and unused. My suspicion is that it's just an old term for "AMDGPU" before it
was upstreamed to LLVM.

See: https://github.com/search?q=repo%3Allvm%2Fllvm-project+amdil&type=code
2024-07-21 22:38:30 +02:00
Alex Rønne Petersen
c825b567b2
std.Target: Remove the r600 arch tag.
These are quite old GPUs, and it is unlikely that Zig will ever be able to
target them.

See: https://en.wikipedia.org/wiki/Radeon_HD_2000_series
2024-07-21 22:38:30 +02:00
Alex Rønne Petersen
9848623e62
std.Target: Remove the renderscript32/renderscript64 arch tags.
It's dead: https://developer.android.com/guide/topics/renderscript/migrate
2024-07-21 22:38:30 +02:00
cheme
01dc0d5a72
Riscv32e align stack to 4 bytes (#20673) 2024-07-21 00:28:22 -07:00
Alex Rønne Petersen
5e82e90dbf
std.Target: Remove coreclr ABI specifier.
This was added to LLVM in 2015 for the LLILC project, which was discontinued in
~2018, and subsequently archived in 2022.

933b58d00f
2024-07-20 05:08:16 +02:00
Alex Rønne Petersen
af8205e25e
std.Target: Remove nacl OS specifier and le32/le64 arch specifiers.
Native Client is dead.

https://developer.chrome.com/docs/native-client
2024-07-20 05:08:16 +02:00
Alex Rønne Petersen
5a2f6acb44
std.Target: Remove kfreebsd OS specifier.
kFreeBSD is dead.

https://lists.debian.org/debian-devel/2023/07/msg00176.html
2024-07-20 05:08:14 +02:00
Alex Rønne Petersen
9939b116bf
std.Target: Remove the gnuf64 ABI specifier.
This was used for LoongArch64, where:

* `gnuf64` -> `ilp32d` / `lp64d` (full hard float)
* `gnuf32` -> `ilp32f` / `lp64f` (hard float for `f32` only)
* `gnusf` -> `ilp32` / `lp64` (soft float)

But Loongson eventually settled on just `gnu` for the first case since that's
what most people will actually be targeting outside embedded scenarios. The
`gnuf32` and `gnusf` specifiers remain in use.
2024-07-20 04:56:56 +02:00
YANG Xudong
b7e48c6bcd
std: Add loongarch support for elf. (#20678) 2024-07-19 16:32:20 -07:00
YANG Xudong
3bf0d2e516
std: Add loongarch support for coff. (#20583)
* std: Add loongarch support for coff.

See: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types

* Update toCoffMachine.
2024-07-12 00:47:32 -07:00
Alex Rønne Petersen
0d7aa1b637 std.Target: Use arch8 as the baseline CPU model for s390x.
Fixes #9442.
2024-07-05 01:52:18 -04:00
Alex Rønne Petersen
2c373b0fb6 std.Target: Update known Windows 10/11 versions and build numbers. 2024-06-16 23:37:38 -04:00
Andrew Kelley
ac3faa6cb3 LLVM backend: loongarch64 support 2024-06-05 13:43:35 -04:00
Veikka Tuominen
8aae0d87b5 Target: add OpenHarmonyOS ABI
Closes #20009
2024-05-20 09:25:52 -04:00
Jakub Konka
2e1fc0dd14 handle visionos target OS tag in the compiler
* rename .xros to .visionos as agreed in the tracking issue
* add support for VisionOS platform in the MachO linker
2024-05-09 15:04:15 +02:00
Andrew Kelley
0b31e2ab27 std.Target: add spirv to toCoffTarget 2024-05-08 19:37:29 -07:00
Andrew Kelley
b7799ef322 std.Target.maxIntAlignment: move to compiler implementation
This should not be a public API, and the x86 backend does not support
the value 16.
2024-05-08 19:37:29 -07:00
Andrew Kelley
a6856ef6d2 LLVM 18 uses 16 byte alignment for x86_64 i128 2024-05-08 19:37:28 -07:00
Andrew Kelley
d34fae26d5 LLVM 18 std lib updates and fixes
* some manual fixes to generated CPU features code. In the future it
  would be nice to make the script do those automatically.

* add to various target OS switches. Some of the values I was unsure of
  and added TODO panics, for example in the case of spirv CPU arch.
2024-05-08 19:37:28 -07:00
Andrew Kelley
243ae3a6cb update for LLVM 18 new target data
New OSs:
* XROS
* Serenity
* Vulkan

Removed OSs:
* Ananas
* CloudABI
* Minix
* Contiki

New CPUs:
* spirv

The removed stuff is removed from LLVM but not Zig.
2024-05-08 19:37:28 -07:00
Jacob Young
60d5001ac8 wasi: change default os version to 0.1.0
This version represents "WASI Preview 1".

Closes #19581
2024-04-14 18:43:52 -04:00
Jacob Young
533f54c68e Target: cleanup 2024-04-14 15:33:46 -04:00
Jacob Young
fcdb7027e9 haiku: fix linking issues 2024-04-08 13:20:14 -04:00
mlugg
9c3670fc93
compiler: implement analysis-local comptime-mutable memory
This commit changes how we represent comptime-mutable memory
(`comptime var`) in the compiler in order to implement the intended
behavior that references to such memory can only exist at comptime.

It does *not* clean up the representation of mutable values, improve the
representation of comptime-known pointers, or fix the many bugs in the
comptime pointer access code. These will be future enhancements.

Comptime memory lives for the duration of a single Sema, and is not
permitted to escape that one analysis, either by becoming runtime-known
or by becoming comptime-known to other analyses. These restrictions mean
that we can represent comptime allocations not via Decl, but with state
local to Sema - specifically, the new `Sema.comptime_allocs` field. All
comptime-mutable allocations, as well as any comptime-known const allocs
containing references to such memory, live in here. This allows for
relatively fast checking of whether a value references any
comptime-mtuable memory, since we need only traverse values up to
pointers: pointers to Decls can never reference comptime-mutable memory,
and pointers into `Sema.comptime_allocs` always do.

This change exposed some faulty pointer access logic in `Value.zig`.
I've fixed the important cases, but there are some TODOs I've put in
which are definitely possible to hit with sufficiently esoteric code. I
plan to resolve these by auditing all direct accesses to pointers (most
of them ought to use Sema to perform the pointer access!), but for now
this is sufficient for all realistic code and to get tests passing.

This change eliminates `Zcu.tmp_hack_arena`, instead using the Sema
arena for comptime memory mutations, which is possible since comptime
memory is now local to the current Sema.

This change should allow `Decl` to store only an `InternPool.Index`
rather than a full-blown `ty: Type, val: Value`. This commit does not
perform this refactor.
2024-03-25 14:49:41 +00:00
Andrew Kelley
9410b11ca6
Merge pull request #19114 from ziglang/lazy-resinator
move `zig libc` command to be lazily built
2024-02-28 11:34:45 -08:00
Andrew Kelley
a4380a30f5 move zig libc command to be lazily built
part of #19063

This is a prerequisite for doing the same for Resinator.
2024-02-27 22:55:00 -07:00
Jacob Young
f446d8e8f9 posix: @as and other general cleanup 2024-02-28 04:30:49 +01:00
Ali Chraghi
afa7793351 spirv: basic shader support 2024-02-05 11:55:14 +03:30
Elaine Gibson
398ab5fcfb mingw: update build logic 2024-01-20 00:24:39 +00:00
Andrew Kelley
8c44954bc6 std.Target.Query: remove deprecated API
These functions have been doomed for a long time. Finally I figured out
what the proper relationship between this API and std.Target is.
2024-01-01 17:51:18 -07:00
Andrew Kelley
dbdb87502d std.Target: add DynamicLinker 2024-01-01 17:51:18 -07:00
Andrew Kelley
3179f58c41 rename std.zig.CrossTarget to std.Target.Query 2024-01-01 17:51:18 -07:00
Andrew Kelley
67d48b94d6 std.Target: flatten 2024-01-01 17:51:18 -07:00