17019 Commits

Author SHA1 Message Date
Andrew Kelley
09d93ec845
Merge pull request #10887 from topolarity/stage2-bitreverse-byteswap
stage2 llvm: Implement `@bitReverse`, `@byteSwap` built-ins
2022-02-18 20:29:31 -05:00
Cody Tapscott
db80dff4e0 Add backend-specific skips for bitreverse, byteswap tests 2022-02-18 14:28:32 -07:00
Cody Tapscott
fe1d6c2f56 Skip failing stage1 @bitReverse test 2022-02-18 14:28:32 -07:00
Cody Tapscott
ef417f19e1 stage2: Implement @bitReverse and @byteSwap
This change implements the above built-ins for Sema and the LLVM
backend. Other backends have had placeholders added for lowering.
2022-02-18 14:28:32 -07:00
Lee Cannon
dee96e2e2f
std.testing.refAllDecls: force decl to be analyzed with just @field
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-02-18 21:21:21 +02:00
Andrew Kelley
2c24bf2f79
Merge pull request #10604 from fifty-six/master
std/os/uefi: additional improvements/fixes
2022-02-18 14:16:30 -05:00
Andrew Kelley
60bb1d4e1c
Merge pull request #10906 from topolarity/cbe-array-support
stage2 CBE: Implement 2D array support
2022-02-18 14:08:06 -05:00
Andrew Kelley
736b9dcdd6
Merge pull request #10858 from topolarity/stage2-bitcast
stage2 sema: Fix sign handling of exotic integers in `@bitCast`
2022-02-18 13:49:00 -05:00
chip2n
ab43c045ed Fix incorrect documentation for std.HashMap.remove() 2022-02-18 13:47:38 -05:00
Jakub Konka
5af9d0c603
Merge pull request #10916 from ziglang/x64-args-stack-debug
stage2,x64: pass all args on stack in debug and if not extern fn
2022-02-18 15:18:01 +01:00
Jakub Konka
0f0bb7e5ea x64: ensure 16byte stack alignment across calls 2022-02-18 13:02:08 +01:00
Veikka Tuominen
53241f288e
Merge pull request #10913 from Vexu/err
further parser error improvements
2022-02-18 13:53:47 +02:00
Jakub Konka
d74e9b2d98 x64: rename copyToNewRegister to copyToRegisterWithInstTracking for impr clarity 2022-02-18 09:14:15 +01:00
Jakub Konka
83744b92a1 x64: fix wrong regalloc with inst tracking in airCmp
We return compare flags rather than a register which than wrongly
cheats the regalloc into thinking we carry the instruction in the
register which we do not.
2022-02-18 09:14:15 +01:00
Jakub Konka
97c25fb8d0 x64: implement array_elem_val when array is stored in memory 2022-02-18 09:14:15 +01:00
Jakub Konka
abfaf8382b x64: implement array_elem_val when array fits in register 2022-02-18 09:14:15 +01:00
Jakub Konka
085c606b87 x64: implement slice_elem_ptr 2022-02-18 09:14:15 +01:00
Jakub Konka
6d3c7bd436 x64: pass all args on stack in debug and if not extern fn
If the function call is not extern and we are compiling in debug,
pass function params always on stack. This will improve debugging
capabilities since the params will not be volatile and possibly
clobbered by the procedure code.

Finish implementation of `imul_complex`.
2022-02-18 09:14:15 +01:00
Andrew Kelley
56e9575e82
Merge pull request #10919 from ziglang/test-more-stage2
CI: more stage2 test coverage
2022-02-18 01:54:34 -05:00
Andrew Kelley
eee500c0b5 build.zig: restore the ability to bootstrap with zig0 via option 2022-02-17 23:49:13 -07:00
Andrew Kelley
dd12a7b1e5 ci: linux: re-use cmake config for finding LLVM 2022-02-17 23:42:48 -07:00
Andrew Kelley
6f42876e74 CLI: resolve system libs into static libraries
using the provided -L directories before checking if we need to integrate
with system library paths. This prevents false positive of invoking
system cc to find native paths when in fact all dependencies are
satisfied by -L (or --search-prefix to zig build).
2022-02-17 23:42:48 -07:00
Andrew Kelley
419074a81b CI: simplify linux script
* build.zig: remove detour through zig0. I'll add it back as an option
   later. This means you can build stage1 with a freshly built zig
   without detouring through zig0 again.
 * remove unused file windows_script.bat
 * drone.yml: remove unnecessary steps
 * ninja doesn't need a jobs parameter
 * build the release version of zig with zig build instead of cmake.
 * build stage2 with -Dstatic-llvm -Duse-zig-libcxx
2022-02-17 23:42:46 -07:00
Andrew Kelley
2f42a2617b CI: more stage2 test coverage
* Test everything on the Linux CI even if we can't run it, because it's
   our fastest machine.
 * Test stage2 using a build of stage2 (instead of using `-fno-stage1`)
   so that compiler-rt is also built with stage2.
 * Additionally test running x86_64-macos on the macOS CI, both the LLVM
   backend and x86_64 backend.
2022-02-17 23:41:58 -07:00
Andrew Kelley
9ea253b9c4 Sema: implement type info for structs 2022-02-17 20:48:09 -07:00
Andrew Kelley
23567cdd98 build.zig: fix test-stage2 regression with -Denable-llvm
Regressed in cc9eb9e90fec961a74e90e1ab3d66a7b8ec14f47 due to a merge
conflict.
2022-02-17 20:48:09 -07:00
Andrew Kelley
0bb22600bd Sema: fix typeinfo for enums with no declarations 2022-02-17 20:48:09 -07:00
Andrew Kelley
feb4b01b38 Sema: fix typeinfo for sentinels of array and pointer 2022-02-17 20:48:09 -07:00
J87
b837855317 Replace magic numbers with clearer representation
Replaces two magic numbers with the procedure used to generate them, in order to keep consistent with other implementations for f64 & f128.
2022-02-17 21:20:04 -05:00
Andrew Kelley
5aa35f62c3 Revert "reduce build error noise"
This reverts commit baead472d7641bdd96130354bafadc1fb1ed223b.

Let's go through the proposal process on this one. I want to push back
on this. My position is that, at the very least, a full trace of command
lines of sub-processes should be printed on failure, with the exception
of opt-in flags such as `--prominent-compile-errors`.
2022-02-17 14:30:12 -07:00
Veikka Tuominen
6235afc632 stage1: fix f80 negation 2022-02-17 23:06:46 +02:00
Veikka Tuominen
6b65590715 parser: add notes to decl_between_fields error 2022-02-17 22:16:26 +02:00
Andrew Kelley
f20929bd8b stage2: fix crash using -femit-bin 2022-02-17 13:12:31 -07:00
Andrew Kelley
63cbec1a96 stage2: add more functions to freestanding libc
The log functions are not passing behavior tests.
2022-02-17 13:11:58 -07:00
Veikka Tuominen
92f2767814 parser: add error for missing colon before continue expr
If a '(' is found where the continue expression was expected and it is
on the same line as the previous token issue an error about missing
colon before the continue expression.
2022-02-17 20:51:26 +02:00
Luuk de Gram
ced958e8a8 wasm-linker: Simplify symbol names
No longer duplicate the symbol name and instead take the pointer from the decl itself.
Also fix 32bit build
2022-02-17 18:11:48 +01:00
Luuk de Gram
4ebe8a53ca wasm-linker: Fix symbol resolving and relocs
- Correctly get discard symbol by first checking if it was discarded or not.
- Remove imports if extern symbols were resolved by an object file.
- Correctly relocate data symbols by ensuring the atom is from the correct file.
- Fix the `Names` section by using the resolved symbols, rather than the ones defined in Zig code.
2022-02-17 18:11:48 +01:00
Luuk de Gram
a4622501bd wasm-linker: Allocate atoms and handle imports
We now correctly allocate and create atoms for symbols from other object files.
Imports are now also resolved and appended when required.
Besides those changes, we now duplicate all symbol names, so we can correctly
generate unique names for unnamed constants.
TODO: String interning
2022-02-17 18:11:48 +01:00
Luuk de Gram
f1cc5f33e8 wasm-linker: Implement section merging
This implements the merging of all sections, to generate a valid wasm binary where all symbols
have been resolved and their respective sections have been merged into the final binary.
2022-02-17 18:11:48 +01:00
Luuk de Gram
e7be0bef43 wasm-linker: Add Object file parsing
This upstreams the object file parsing from zwld, bringing us closer to being able
to link stage2 code with object files/C-code as well as replacing lld with the self-hosted
linker once feature complete.
2022-02-17 18:11:48 +01:00
Jakub Konka
d1c74ac42d
Merge pull request #10914 from ziglang/x64-more-codegen
stage2,x64: refactor stack mgmt mechanics, implement slice, fix ptr_add and ptr_sub
2022-02-17 18:05:30 +01:00
Veikka Tuominen
c9dde10f86 stage1: improve error message when casting tuples 2022-02-17 17:39:54 +02:00
Jakub Konka
3193cc1c1e x64: fix ptr_add and ptr_sub
Add standalone implementation of operand reuse for ptr related
arithmetic operations of add and sub.
2022-02-17 15:07:42 +01:00
Jonathan Marler
baead472d7 reduce build error noise
Address https://github.com/ziglang/zig/issues/3477
This provides a mechanism for builds to fully report an error to the user and prevent zig from piling on extra noise.
2022-02-17 14:48:22 +02:00
John Schmidt
e2ad95c088 stage2: implement vector floatops 2022-02-17 14:47:21 +02:00
Koakuma
755d116ecf stage1: use u16 for __truncxfhf2/__extendhfxf2 on non-Arm CPUs
Non-Arm CPUs use u16 as the parameter to __extendhfxf2 and the return value of
__truncxfhf2, so insert appropriate bitcasts in gen_soft_f80_widen_or_shorten.
Otherwise, LLVM might crash because the functions are called in a different way
than its compiler-rt definition.

This fixes stage1 build on SPARCv9, and possibly other non-x86, non-Arm CPUs.
2022-02-17 14:46:04 +02:00
Veikka Tuominen
35e989235b parser: get rid of "invalid token" error 2022-02-17 14:23:42 +02:00
Veikka Tuominen
9c36cf92f0 parser: make some errors point to end of previous token
For some errors if the found token is not on the same line as
the previous token, point to the end of the previous token.
This usually results in more helpful errors.
2022-02-17 14:23:35 +02:00
Hadrien Dorio
02902cc099
ci: azure: split build-and-test step (#10853)
replace the .bat script by a pwsh script
2022-02-16 22:33:08 -05:00
Andrew Kelley
df8c325012
Merge pull request #10907 from ziglang/ci-windows-zig-cc
CI: windows: depend on Zig instead of CMake and MSVC
2022-02-16 20:44:42 -05:00