4517 Commits

Author SHA1 Message Date
Frank Denis
0c520cd32d Enable loop interleaving when unrolling is enabled
This mimics clang's default behavior.
2020-11-16 13:40:52 -08:00
Jakub Konka
8f47e8feb6 stage2 aarch64: add NOP instruction 2020-11-16 13:37:38 -08:00
Alexandros Naskos
6e2e747b0b
Merge pull request #7112 from LemonBoy/fix-7104
stage1: Fix generation of pass-by-value args in async fns
2020-11-16 09:12:42 +02:00
LemonBoy
7ebbc717c0 stage1: Fix generation of pass-by-value args in async fns
The mismatch between the argument slot type in the frame structure and
the one used in the store operation made the generated code write
garbage over the nearby fields.

Fixes #7104
2020-11-14 15:30:06 +01:00
LemonBoy
211feea914 stage1: Disambiguate Wasm imports with same name
Closes #7088
2020-11-13 16:32:42 -05:00
LemonBoy
c4fd3fc270 stage1: Resolve ErrorUnion children types
Since the code is accessing the abi_size field compute the full type
size for both err_set_type and payload_type, not only for the latter.
2020-11-13 14:28:40 -07:00
LemonBoy
b52a28a802 stage1: Ask LLVM to produce compact code in ReleaseSize mode
Let's follow what Clang does for -Oz and apply the `minsize` and
`optsize` attributes by default.

Closes #7048
Supersedes #7077
2020-11-13 12:25:13 -05:00
Jakub Konka
51717314e4
Merge pull request #6900 from joachimschmidt557/stage2-aarch64
Add stage2 AArch64 backend
2020-11-12 20:41:15 +01:00
joachimschmidt557
c6d46a9b82
stage2 ARM & AArch64: ensure correct function alignment 2020-11-12 16:24:51 +01:00
Andrew Kelley
2d42532fec main: clean up the error message for missing positional args 2020-11-11 19:35:07 -07:00
Vexu
08270d72b4 ensure TypeInfo payload is not undefined 2020-11-11 16:04:46 +02:00
g-w1
61c51f0ac9
Add error for missing positional arguments in zig build-*
Closes #6938
2020-11-11 15:54:08 +02:00
LemonBoy
5872ae5111 stage1: Fix crash in comptime struct generation
Using the gen_index rather than the src_index is needed to handle
structures containing zero-sized or comptime only types.

Closes #7027
2020-11-11 15:35:19 +02:00
Jakub Konka
a6bc19ea2a stage2 aarch64: add genCall for aarch64 MachO 2020-11-11 14:34:53 +01:00
Jakub Konka
993eb22a77 stage2 aarch64: add .memory prong in genSetReg 2020-11-11 14:34:53 +01:00
Jakub Konka
f512676d0b stage2 aarch64: add str instruction 2020-11-11 14:34:53 +01:00
Jakub Konka
f1960302d1 stage2 aarch64: add ldr instruction + smoke tests 2020-11-11 14:34:53 +01:00
joachimschmidt557
ca0016a225 stage2 ARM: start implementing genCall for ELF + genSetReg immediates 2020-11-11 14:34:53 +01:00
joachimschmidt557
aa9df72f71 stage2 AArch64: MoveWideImmediate instructions + test coverage 2020-11-11 14:34:53 +01:00
joachimschmidt557
4c8f69241a stage2 aarch64: add more instructions 2020-11-11 14:34:53 +01:00
joachimschmidt557
3c75d723ac stage2 aarch64: add codegen/aarch64.zig 2020-11-11 14:34:53 +01:00
Jakub Konka
4ef6864a15 Add move wide with zero (movz) instruction 2020-11-11 14:34:53 +01:00
Jakub Konka
d601b0f4eb Add basic genSetReg for aarch64 2020-11-11 14:34:53 +01:00
Jakub Konka
68bb1e91aa Add testcase for serializing svc #0x80 2020-11-11 14:34:53 +01:00
Jakub Konka
d542e88706 Implement genAsm on aarch64
Add remaining PCS info: param and return registers in procedure calls.
2020-11-11 14:34:53 +01:00
joachimschmidt557
5ad501c00b stage2 aarch64: add codegen/aarch64.zig 2020-11-11 14:34:53 +01:00
LemonBoy
f0b1b74d21 stage1: Avoid resolving type entry in [0]T
The logic was already there but this rule was only applied in some
places, apply it in the remaining code paths.

Closes #7058
2020-11-11 13:53:24 +02:00
Andrew Kelley
6904cd828e add missing -m<os>-version-min CLI args to clang
This fixes some code generation issues when targeting macOS and
compiling C/C++ code.
2020-11-10 15:24:10 -07:00
LemonBoy
4d4ab1e69a stage1: Fix comparison of unions containing zero-sized types
The code tried to be too smart and skipped the equality (returning true)
if the payload type was zero-sized.
This optimization is completely wrong when the union payload is a
metatype!

Fixes #7047
2020-11-10 17:21:49 -05:00
Andrew Kelley
06a3a69e6f main: updateModule returns an error when there are any compile errors
closes #6976
2020-11-09 20:51:09 -07:00
LemonBoy
e00356d6b1 stage1: Print correct error message for vector @intCast 2020-11-09 18:24:48 -05:00
Andrew Kelley
e78e0f57be macos: avoid --export-dynamic when using system linker 2020-11-08 23:04:38 -08:00
Andrew Kelley
4d67c3d887 macOS: depend on bundled headers even for native
This is an alternate fix for #6773. Reverts
872bc787b56f71e53c80f4681523bc8356915b71.
2020-11-08 18:51:12 -07:00
joachimschmidt557
03ae77b8b0 stage2 ARM: miscellaneous improvements 2020-11-07 17:27:23 +01:00
Alexandros Naskos
5430642fa0
Merge pull request #7008 from xackus/minor-fixes
change debug.assert to testing.expect in tests
2020-11-07 11:34:51 +02:00
xackus
c9fa57541b remove outdated comment 2020-11-06 22:58:58 +01:00
Andrew Kelley
e5fab3ba68 update musl sources to 1.2.1 2020-11-06 14:13:57 -07:00
Andrew Kelley
a9e09a8be4
Merge pull request #6990 from kubkon/system-linker-hack
Re-enable system linker hack
2020-11-06 13:22:03 -05:00
Jakub Konka
ab69b89d52 Address review comments 2020-11-06 11:57:53 +01:00
Vexu
79549e0ac1
translate-c: fix macro functions with no arguments 2020-11-06 12:48:52 +02:00
Jakub Konka
b7c3ebcb9e Rely on ZIG_SYSTEM_LINKER_HACK instead of input flags 2020-11-06 11:34:51 +01:00
LemonBoy
78840c4ab2 stage1: Make sure union(enum(T)) is valid
The T type should be wide enough to fit values in the  0...num field
range.

Closes #6988
2020-11-05 17:24:04 -05:00
Alexandros Naskos
3e1639c53b
Fixed mingw-w64 8.0.0 compilation
Reaplied mingw-w64 header patch
2020-11-05 20:04:25 +02:00
Jakub Konka
e0e3ceac19 Re-enable system linker hack
It is now possible to force linking with system linker `ld` instead
of the LLVM `lld` linker when building natively on the target. This
can be done at each stage by specifying `--system-linker-hack` flag,
and can be useful on platforms where `lld` fails to operate properly
such as macOS 11 Big Sur on ARM64 where every binary/dylib is expected
to be codesigned.

Some example invocations for each stage of compilation of Zig
toolchain:

```
cmake .. -DCMAKE_PREFIX_PATH=/path/to/llvm -DSYSTEM_LINKER_HACK=1
```

```
build/zig build test --system-linker-hack
```

```
build/zig build --prefix $(pwd)/stage2 -Denable-llvm
--system-linker-hack
```

```
build/zig build-exe hello.zig --system-linker-hack
```
2020-11-05 18:35:51 +01:00
Alexandros Naskos
708962d51e
Updated mingw-w64 to version 8.0.0 2020-11-05 18:59:36 +02:00
Jakub Konka
5060497174
Merge pull request #6921 from xackus/gimmeMoreOfThoseSweetSweetFileDescriptors
stage2: ask for more file descriptors
2020-11-03 10:07:39 +01:00
xackus
e023a5fe5d force comptime on isDarwin 2020-11-03 00:58:35 +01:00
Jakub Konka
8dda64fa3e
Fix Darwin codepath
On Darwin, according to the man pages for setrlimit(), when adjusting
max number of open fds, the reported hard max by getrlimit() is only
theoretical, while the actual maximum, set in the kernel, is hardcoded
in the header file. Therefore, the reported max has to be adjusted
as `min(OPEN_MAX, lim.max)`.

Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-11-03 00:38:43 +01:00
xackus
06b4526a3e fix freebsd compilation 2020-11-02 23:18:55 +01:00
Andrew Kelley
00ceb592ef
Merge pull request #6932 from kubkon/fix-6318
macOS: fix linking issues on BigSur
2020-11-02 13:41:32 -05:00