aboutsummaryrefslogtreecommitdiff
path: root/lib/compiler/aro
AgeCommit message (Collapse)Author
2024-08-21compiler: handle eval branch quota in memoized callsmlugg
In a `memoized_call`, store how many backwards braches the call performs. Add this to `sema.branch_count` when using a memoized call. If this exceeds the quota, perform a non-memoized call to get a correct "exceeded X backwards branches" error. Also, do not memoize calls which do `@setEvalBranchQuota` or similar, as this affects global state which must apply to the caller. Change some eval branch quotas so that the compiler itself still builds correctly. This commit manually changes a file in Aro which is automatically generated. The sources which generate the file are not in this repo. Upstream Aro should make the suitable changes on their end before the next sync of Aro sources into the Zig repo.
2024-08-15Merge pull request #21020 from alexrp/target-fixesAndrew Kelley
`std.Target`: Assorted corrections, plus cleanup around ELF/COFF machine types
2024-08-15std.time.epoch: Fix comments referring to epoch as 1970-10-01Linus Groh
2024-08-15std.Target: Pull toCoffMachine()/toElfMachine() up from Arch to Target.Alex Rønne Petersen
This enables them to give more correct results. Contributes to #20771.
2024-08-14Merge pull request #21031 from linusg/std-target-namingAndrew Kelley
std.Target: Function naming cleanup
2024-08-12std.Target: Remove liteos OS tag.Alex Rønne Petersen
It has not seen development in 4 years. https://github.com/LiteOS/LiteOS/commits/master
2024-08-12std.Target: Remove minix OS tag.Alex Rønne Petersen
It has not seen development in 6 years. RIP. * https://github.com/Stichting-MINIX-Research-Foundation/minix/commits/master * https://groups.google.com/g/minix3/c/nUG1NwxXXkg
2024-08-12std.Target: Rename glsl450 Arch tag to opengl.Alex Rønne Petersen
Versions can simply use the normal version range mechanism, or alternatively an Abi tag if that makes more sense. For now, we only care about 4.5 anyway.
2024-08-12std.Target: Rename c_type_* functions to camel caseLinus Groh
From https://ziglang.org/documentation/master/#Names: > If `x` is otherwise callable, then `x` should be `camelCase`.
2024-08-07Merge pull request #20894 from alexrp/target-cleanup-4Andrew Kelley
`std.Target`: Minor rework to some `isArch()` functions, fix some related issues throughout `std`
2024-08-04std.sort: Remove key argument from binary-search-like functions (#20927)Fri3dNstuff
closes #20110
2024-08-01std.Target: Rework isPPC()/isPPC64() functions.Alex Rønne Petersen
* Rename isPPC() -> isPowerPC32(). * Rename isPPC64() -> isPowerPC64(). * Add new isPowerPC() function which covers both. There was confusion even in the standard library about what isPPC() meant. This change makes these functions work how I think most people actually expect them to work, and makes them consistent with isMIPS(), isSPARC(), etc. I chose to rename from PPC to PowerPC because 1) it's more consistent with the other functions, and 2) it'll cause loud rather than silent breakage for anyone who might have been depending on isPPC() while misunderstanding it.
2024-07-30std.Target: Remove `cloudabi` OS tag.Alex Rønne Petersen
It's discontinued in favor of WASI. https://github.com/NuxiNL/cloudlibc
2024-07-30std.Target: Remove `ananas` OS tag.Alex Rønne Petersen
This is a fairly small hobby OS that has not seen development in 2 years. Our current policy is that hobby OSs should use the `other` tag. https://github.com/zhmu/ananas
2024-07-30std.Target: Remove `sparcel` architecture tag.Alex Rønne Petersen
What is `sparcel`, you might ask? Good question! If you take a peek in the SPARC v8 manual, §2.2, it is quite explicit that SPARC v8 is a big-endian architecture. No little-endian or mixed-endian support to be found here. On the other hand, the SPARC v9 manual, in §3.2.1.2, states that it has support for mixed-endian operation, with big-endian mode being the default. Ok, so `sparcel` must just be referring to SPARC v9 running in little-endian mode, surely? Nope: * https://github.com/llvm/llvm-project/blob/40b4fd7a3e81d32b29364a1b15337bcf817659c0/llvm/lib/Target/Sparc/SparcTargetMachine.cpp#L226 * https://github.com/llvm/llvm-project/blob/40b4fd7a3e81d32b29364a1b15337bcf817659c0/llvm/lib/Target/Sparc/SparcTargetMachine.cpp#L104 So, `sparcel` in LLVM is referring to some sort of fantastical little-endian SPARC v8 architecture. I've scoured the internet and I can find absolutely no evidence that such a thing exists or has ever existed. In fact, I can find no evidence that a little-endian implementation of SPARC v9 ever existed, either. Or any SPARC version, actually! The support was added here: https://reviews.llvm.org/D8741 Notably, there is no mention whatsoever of what CPU this might be referring to, and no justification given for the "but some are little" comment added in the patch. My best guess is that this might have been some private exercise in creating a little-endian version of SPARC that never saw the light of day. Given that SPARC v8 explicitly doesn't support little-endian operation (let alone little-endian instruction encoding!), and no CPU is known to be implemented as such, I think it's very reasonable for us to just remove this support.
2024-07-30std.Target: Remove `spir`/`spir64` architecture tags.Alex Rønne Petersen
These were for very old OpenCL have been long abandoned in favor of SPIR-V. * https://github.com/KhronosGroup/SPIR * https://github.com/KhronosGroup/SPIR-Tools
2024-07-28std.Target.Cpu.Arch: Remove the `aarch64_32` tag.Alex Rønne Petersen
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-21std.Target.Os: Rename lv2 to ps3.Alex Rønne Petersen
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-21std.Target: Remove the `tce`/`tcele` arch tags.Alex Rønne Petersen
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-21std.Target: Remove the `shave` arch tag.Alex Rønne Petersen
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: https://github.com/llvm/llvm-project/commit/1b5767f72b5a037ca8f1802d737de97f8d92263d See: https://github.com/llvm/llvm-project/commit/84a7564b28360843ee9afec5d3823c89623eb6a5 See: https://github.com/llvm/llvm-project/commit/8cfe9d8f2ad3a52ba7fd5841d3939aa810536e16
2024-07-21std.Target: Remove `hsail`/`hsail64` arch tags.Alex Rønne Petersen
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-21std.Target: Remove `amdil`/`amdil64` arch tags.Alex Rønne Petersen
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-21std.Target: Remove the `r600` arch tag.Alex Rønne Petersen
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-21std.Target: Remove the `renderscript32`/`renderscript64` arch tags.Alex Rønne Petersen
It's dead: https://developer.android.com/guide/topics/renderscript/migrate
2024-07-20std.Target: Remove `coreclr` ABI specifier.Alex Rønne Petersen
This was added to LLVM in 2015 for the LLILC project, which was discontinued in ~2018, and subsequently archived in 2022. https://github.com/dotnet/llilc/commit/933b58d00ffb4b357956c940b37a379bdf891324
2024-07-20std.Target: Remove `nacl` OS specifier and `le32`/`le64` arch specifiers.Alex Rønne Petersen
Native Client is dead. https://developer.chrome.com/docs/native-client
2024-07-20std.Target: Remove `kfreebsd` OS specifier.Alex Rønne Petersen
kFreeBSD is dead. https://lists.debian.org/debian-devel/2023/07/msg00176.html
2024-07-20std.Target: Remove the `gnuf64` ABI specifier.Alex Rønne Petersen
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-03Rename MAX_NAME_BYTES to max_name_bytesMichael Bradshaw
2024-07-02Rename isASCII to isAsciiMichael Bradshaw
2024-06-13std: Convert deprecated aliases to compile errors and fix usagesRyan Liptak
Deprecated aliases that are now compile errors: - `std.fs.MAX_PATH_BYTES` (renamed to `std.fs.max_path_bytes`) - `std.mem.tokenize` (split into `tokenizeAny`, `tokenizeSequence`, `tokenizeScalar`) - `std.mem.split` (split into `splitSequence`, `splitAny`, `splitScalar`) - `std.mem.splitBackwards` (split into `splitBackwardsSequence`, `splitBackwardsAny`, `splitBackwardsScalar`) - `std.unicode` + `utf16leToUtf8Alloc`, `utf16leToUtf8AllocZ`, `utf16leToUtf8`, `fmtUtf16le` (all renamed to have capitalized `Le`) + `utf8ToUtf16LeWithNull` (renamed to `utf8ToUtf16LeAllocZ`) - `std.zig.CrossTarget` (moved to `std.Target.Query`) Deprecated `lib/std/std.zig` decls were deleted instead of made a `@compileError` because the `refAllDecls` in the test block would trigger the `@compileError`. The deleted top-level `std` namespaces are: - `std.rand` (renamed to `std.Random`) - `std.TailQueue` (renamed to `std.DoublyLinkedList`) - `std.ChildProcess` (renamed/moved to `std.process.Child`) This is not exhaustive. Deprecated aliases that I didn't touch: + `std.io.*` + `std.Build.*` + `std.builtin.Mode` + `std.zig.c_translation.CIntLiteralRadix` + anything in `src/`
2024-05-27update the codebase for the new std.Progress APIAndrew Kelley
2024-05-26std: restructure child process namespaceAndrew Kelley
2024-05-09Merge pull request #19918 from ziglang/xrosAndrew Kelley
Add support for VisionOS
2024-05-09aro translate-c: support for record types addedfebruary cozzocrea
2024-05-09handle visionos target OS tag in the compilerJakub Konka
* rename .xros to .visionos as agreed in the tracking issue * add support for VisionOS platform in the MachO linker
2024-05-08std.Target.maxIntAlignment: move to compiler implementationAndrew Kelley
This should not be a public API, and the x86 backend does not support the value 16.
2024-04-22ComptimeStringMap: return a regular struct and optimizeTravis Staloch
this patch renames ComptimeStringMap to StaticStringMap, makes it accept only a single type parameter, and return a known struct type instead of an anonymous struct. initial motivation for these changes was to reduce the 'very long type names' issue described here https://github.com/ziglang/zig/pull/19682. this breaks the previous API. users will now need to write: `const map = std.StaticStringMap(T).initComptime(kvs_list);` * move `kvs_list` param from type param to an `initComptime()` param * new public methods * `keys()`, `values()` helpers * `init(allocator)`, `deinit(allocator)` for runtime data * `getLongestPrefix(str)`, `getLongestPrefixIndex(str)` - i'm not sure these belong but have left in for now incase they are deemed useful * performance notes: * i posted some benchmarking results here: https://github.com/travisstaloch/comptime-string-map-revised/issues/1 * i noticed a speedup reducing the size of the struct from 48 to 32 bytes and thus use u32s instead of usize for all length fields * i noticed speedup storing KVs as a struct of arrays * latest benchmark shows these wall_time improvements for debug/safe/small/fast builds: -6.6% / -10.2% / -19.1% / -8.9%. full output in link above.
2024-03-30Update uses of `@fieldParentPtr` to use RLSJacob Young
2024-03-30Update uses of `@fieldParentPtr` to pass a pointer typeJacob Young
2024-03-11std.builtin: make container layout fields lowercaseTristan Ross
2024-03-06Sync Aro sources (#19199)Veikka Tuominen
ref: 02353ad9f17f659e173f68975a442fcec3dd2c94
2024-02-28zig fmt: off in the generated filesAndrew Kelley
2024-02-28make aro-based translate-c lazily built from sourceAndrew Kelley
Part of #19063. Primarily, this moves Aro from deps/ to lib/compiler/ so that it can be lazily compiled from source. src/aro_translate_c.zig is moved to lib/compiler/aro_translate_c.zig and some of Zig CLI logic moved to a main() function there. aro_translate_c.zig becomes the "common" import for clang-based translate-c. Not all of the compiler was able to be detangled from Aro, however, so it still, for now, remains being compiled with the main compiler sources due to the clang-based translate-c depending on it. Once aro-based translate-c achieves feature parity with the clang-based translate-c implementation, the clang-based one can be removed from Zig. Aro made it unnecessarily difficult to depend on with these .def files and all these Zig module requirements. I looked at the .def files and made these observations: - The canonical source is llvm .def files. - Therefore there is an update process to sync with llvm that involves regenerating the .def files in Aro. - Therefore you might as well just regenerate the .zig files directly and check those into Aro. - Also with a small amount of tinkering, the file size on disk of these generated .zig files can be made many times smaller, without compromising type safety in the usage of the data. This would make things much easier on Zig as downstream project, particularly we could remove those pesky stubs when bootstrapping. I have gone ahead with these changes since they unblock me and I will have a chat with Vexu to see what he thinks.