17102 Commits

Author SHA1 Message Date
Veikka Tuominen
92beb2b490 stage2: misc fixes in Sema 2022-02-23 10:40:40 +02:00
Veikka Tuominen
923b07bac7 stage2: add parameters to fn typeInfo 2022-02-23 09:44:36 +02:00
Veikka Tuominen
f8154905e7 stage1: rename TypeInfo.FnArg to Fn.Param 2022-02-23 09:44:36 +02:00
Jakub Konka
e5c30eef1f
Merge pull request #10949 from ziglang/x64-print-results
stage2,x64: print test_runner results
2022-02-22 23:06:07 +01:00
Jakub Konka
c64d3b0a96 Skip @src for stage1 too 2022-02-22 22:33:57 +01:00
Jakub Konka
160f657156 Skip unsupported while behavior tests 2022-02-22 22:14:49 +01:00
Jakub Konka
8e4a8771f5 Skip unsupported enum behavior tests 2022-02-22 22:04:32 +01:00
Jakub Konka
8abd30019c x64: completely ignore printing tests on macos until I fix the linker 2022-02-22 21:57:44 +01:00
Jakub Konka
d657ede324 x64: disable printing results on macos until I fix the linker
Hopefully, this will make the CI green, and in the meantime I can
fix the bugs in the MachO linker.
2022-02-22 21:57:44 +01:00
Jakub Konka
25e4b16e25 Port more behavior tests 2022-02-22 21:57:42 +01:00
Jakub Konka
a94267b290 std: export ceil builtins in stage2 2022-02-22 21:56:34 +01:00
Jakub Konka
1bbb886694 Port bitcast.zig tests 2022-02-22 21:56:34 +01:00
Jakub Konka
150006d216 std: enable print results in test_runner for stage2_x86_64 2022-02-22 21:56:34 +01:00
Jakub Konka
3be6c79ca2 x64: spill compare flags between blocks, extern calls, and cmp insts
This is just the first step towards the final solution as to get
here I had omit a safety assert check in `getResolvedInst` helper.
2022-02-22 21:56:34 +01:00
Jakub Konka
b9b4e4671f x64: add naive impl of else in switch 2022-02-22 21:56:34 +01:00
Jakub Konka
2617117221 x64: fix lowering of error unions (we didn't pad to alignment)
* fix returning large values on stack from procedure calls - we
  need to explicitly specify source and dest base registers for
  `genSetStack` as well
2022-02-22 21:56:34 +01:00
Jakub Konka
87a0d754be x64: add basic, naive impl of switch 2022-02-22 21:56:34 +01:00
Jakub Konka
2d3462c79a liveness: add helper for extracting liveness of switch branch 2022-02-22 21:56:34 +01:00
Jakub Konka
5ba66911fa x64: add basic impl of shl for integers 2022-02-22 21:56:34 +01:00
Jakub Konka
71dda25f14 x64: add basic impl of minimum builtin for ints 2022-02-22 21:56:34 +01:00
Jakub Konka
25d313f911 codegen: lower repeated and empty_with_sentinel array type 2022-02-22 21:56:34 +01:00
Jakub Konka
57c9eec232 x64: implement unwrap_err_payload and unwrap_err_err for stack offset 2022-02-22 21:56:34 +01:00
Jakub Konka
f4f23e307c codegen: lower error_set and error_union 2022-02-22 21:56:34 +01:00
Jakub Konka
358b544157 x64: recover address in rdi if was spilled 2022-02-22 21:56:34 +01:00
Jakub Konka
630da643c6 x64: pass pointer to stack for return value in .rdi register 2022-02-22 21:56:34 +01:00
Jakub Konka
478f770053 x64: first, really horrible attempt at returning values on stack 2022-02-22 21:56:34 +01:00
Jakub Konka
e582c0a043 x64: reorder resolving call params: return values first, then params 2022-02-22 21:56:34 +01:00
Jakub Konka
8bc95b22dc x64: sub is non-commutative 2022-02-22 21:56:34 +01:00
Andrew Kelley
b23f10b424 Sema: fix comptime coercion of payload to error union 2022-02-22 13:53:10 -07:00
Andrew Kelley
0d422ce342 Sema: auto-numbered enums increment from last tag value
This matches stage1 and the existing behavior tests.
2022-02-22 12:44:35 -07:00
Motiejus Jakštys
e620b692c6 [std.ArrayList] return explicit errors
All errors from std.ArrayList are allocation errors. Mark them as such.
This is helpful when one wants to obtain a function pointer.
2022-02-22 13:57:51 -05:00
Veikka Tuominen
df38c46bee
Merge pull request #10929 from davidmrt98/cbe
stage2: C backend: fix codegen for field_ptr/elem_ptr values
2022-02-22 15:25:50 +02:00
Andrew Kelley
c2a9a591f6 Sema: fix union auto-enum numbering 2022-02-21 23:50:20 -07:00
Andrew Kelley
9dc98fbabb Sema: fix comptime union initialization
The mechanism behind initializing a union's tag is a bit complicated,
depending on whether the union is initialized at runtime,
forced comptime, or implicit comptime.

`coerce_result_ptr` now does not force a block to be a runtime context;
instead of adding runtime instructions directly, it forwards analysis to
the respective functions for initializing optionals and error unions.

`validateUnionInit` now has logic to still emit a runtime
`set_union_tag` instruction even if the union pointer is comptime-known,
for the case of a pointer that is not comptime mutable, such as a
variable or the result of `@intToPtr`.

`validateStructInit` looks for a completely different pattern now; it
now handles the possibility of the corresponding AIR instruction for
the `field_ptr` to be missing or the corresponding `store` to be missing.
See the new comment added to the function for more details. An
equivalent change should probably be made to `validateArrayInit`.

`analyzeOptionalPayloadPtr` and `analyzeErrUnionPayloadPtr` functions now
emit a `optional_payload_ptr_set` or `errunion_payload_ptr_set`
instruction respectively if `initializing` is true and the pointer value
is not comptime-mutable.

`storePtr2` now tries the comptime pointer store before checking if the
element type has one possible value because the comptime pointer store
can have side effects of setting a union tag, setting an optional payload
non-null, or setting an error union to be non-error.

The LLVM backend `lowerParentPtr` function is improved to take into
account the differences in how the LLVM values are lowered depending on
the Zig type. It now handles unions correctly as well as additionally
handling optionals and error unions.

In the LLVM backend, the instructions `optional_payload_ptr_set` and
`errunion_payload_ptr_set` check liveness analysis and only do the side
effects in the case the result of the instruction is unused.

A few wasm and C backend test cases regressed, but they are due to TODOs
in lowering of constants, so this is progress.
2022-02-21 23:49:38 -07:00
Andrew Kelley
7f48bc3493 disable failing nvptx test case
workaround for #10968
2022-02-21 23:48:07 -07:00
Andrew Kelley
6dc5ce931c
Merge pull request #10959 from joachimschmidt557/stage2-aarch64
stage2 AArch64: misc improvements
2022-02-22 01:30:49 -05:00
joachimschmidt557
25f73224f7
stage2 AArch64: pass a few more behavior tests 2022-02-21 23:05:16 +01:00
joachimschmidt557
2ba1ef165a
stage2 AArch64: implement genSetReg for ptr_stack_offset 2022-02-21 22:54:14 +01:00
joachimschmidt557
ec62e76455
stage2 AArch64: replace genMulConstant with binOp 2022-02-21 22:54:09 +01:00
joachimschmidt557
19c683fab0
stage2 AArch64: distinguish between sp/wsp and xzr/wzr 2022-02-21 22:44:47 +01:00
joachimschmidt557
a9154a7eaf
stage2 AArch64: implement storing to memory 2022-02-21 22:44:40 +01:00
Andrew Kelley
74303a3d95
Merge pull request #10925 from Vexu/stage2
stage2: support anon init through error unions and optionals
2022-02-21 14:18:17 -05:00
gwenzek
628e9e6d04
enable Gpu address spaces (#10884) 2022-02-21 14:05:27 -05:00
Carlos Zúñiga
d8da9a01fc Use lowercase in shasum for windows builds 2022-02-21 00:40:46 -05:00
Ali Chraghi
a4df443f96 Update Tokenizer Dump Function
fix missed `loc` field
2022-02-20 17:47:42 -05:00
Steven Fackler
2c8541bdde Support -Wl,--soname 2022-02-20 13:56:12 -05:00
David John
bdb5713941 stage2: fix typo in riscv64/Emit.zig 2022-02-20 19:10:54 +01:00
Luuk de Gram
bb05a8a08a stage2: Fix 32bit builds 2022-02-20 18:16:28 +01:00
Veikka Tuominen
a5ac062689 stage2: make field/array base ptr work at comptime 2022-02-20 11:59:49 +02:00
Veikka Tuominen
65aa333197 fix formatting in openbsd.zig
CI was failing for unrelated reasons so this went unnoticed
2022-02-20 11:58:42 +02:00