11807 Commits

Author SHA1 Message Date
Robin Voetter
0bae2caaf3
spirv: lower air try
Implements code generation for the try air tag. This commit also adds
a utility `errorUnionLayout` function that helps keeping the layout
of a spir-v error union consistent.
2023-05-11 20:31:50 +02:00
Robin Voetter
dfecf89d06
spirv: fix OpFunctionCall parameters interleaving with insts
resolve() is now able to emit instructions. If usage of this function is
interleaved with calls to emitRaw() and writeOperand(), then an
instruction may get inserted between operands, causing an invalid module.
The solution here is to just perform a temporary allocation.
2023-05-11 20:31:50 +02:00
Robin Voetter
5d896a6cc6
spirv: fix use-after-realloc in resolveType()
The pointer to a slot in a hash map was fetched before a recursive call.
If the hash map's size changed during the recursive call, this would write
to an invalid pointer.

The solution is to use an index instead of a pointer. Note that care must be
taken that resolved types (from the type_cahce) must not be accessed, as they
might be incomplete during this operation.
2023-05-11 20:31:50 +02:00
Andrew Kelley
7f7bd206dc
Merge pull request #15519 from dweiller/issue-15482
Optimize lowering of `s[start..][0..len]`
2023-05-11 08:59:44 -07:00
Loris Cro
5512455974
Merge pull request #15637 from der-teufel-programming/autodoc-layouts
autodoc: Add layout to Struct and Union to handle packed and extern
2023-05-11 17:46:29 +02:00
Andrew Kelley
5569e6b49d
Merge pull request #15639 from jacobly0/signed-mod
llvm/cbe: fix signed `@mod`/`@divFloor` computations
2023-05-11 08:36:33 -07:00
Andrew Kelley
c857959372
Merge pull request #15640 from jacobly0/min-max
llvm: fix `@max`/`@min` of unsupported float types
2023-05-11 08:35:08 -07:00
John Schmidt
2606498409 module: return null if no candidate src
Closes #15572.
2023-05-11 11:21:44 +03:00
Jacob Young
c5b96c7447 llvm: fix @max/@min of unsupported float types
Closes #15611
2023-05-10 15:16:50 -04:00
Jacob Young
2e6a6d7564 llvm/cbe: fix signed @mod/@divFloor computations
Closes #15636
2023-05-10 15:11:52 -04:00
Jacob Young
31a13ce2e3 cbe: use Assignment in airSplat 2023-05-10 15:11:52 -04:00
Loris Cro
2d2d79a05b autodoc: fix crash when call syntax has complex callee expression 2023-05-10 21:07:40 +02:00
Veikka Tuominen
ae69fb87eb
Merge pull request #15508 from r00ster91/semathings
Sema: fixes to error messages
2023-05-10 16:12:46 +03:00
Krzysztof Wolicki
b7ba9aa892 autodoc: Add layout to Struct and Union to properly display packed and extern;
Make rendering of types in exprName more similar to zig fmt
2023-05-10 01:53:00 +02:00
Andrew Kelley
e02a592437 Autodoc: update favicon to latest logo mark
ziglang/logo commit 6446ba8e37a0651da720d8869e1ce9264fa0c0b9
2023-05-09 14:24:21 -07:00
Loris Cro
8e9c9f6fdc
Merge pull request #15623 from der-teufel-programming/autodoc-backing-int
Autodoc: backing integer types for packed structs
2023-05-09 20:09:42 +02:00
r00ster91
297b5d1074 fix [x]u65529 and above overflowing
```
$ cat overflow.zig
test {
    var a: [1]u65535 = undefined;
    _ = a;
}
$ zig-out/bin/zig test overflow.zig
thread 290266 panic: integer overflow
zig/src/type.zig:3604:55: 0xada43d in intAbiAlignment (zig)
            std.math.ceilPowerOfTwoPromote(u16, (bits + 7) / 8),
                                                      ^
zig/src/type.zig:3598:42: 0xadd4ea in intAbiSize (zig)
        const alignment = intAbiAlignment(bits, target);
                                         ^
zig/src/type.zig:3500:61: 0x92be91 in abiSizeAdvanced (zig)
                return AbiSizeAdvanced{ .scalar = intAbiSize(bits, target) };
                                                            ^
zig/src/type.zig:3385:62: 0x928933 in abiSizeAdvanced (zig)
                switch (try payload.elem_type.abiSizeAdvanced(target, strat)) {
                                                             ^
zig/src/type.zig:3268:32: 0x92c012 in abiSize (zig)
        return (abiSizeAdvanced(ty, target, .eager) catch unreachable).scalar;
                               ^
```
This is only noticed in a debug build of zig and silently does the wrong
thing and overflows in release builds.

This happened to `[x]u65529` and above because of the ` + 7` on a `u16`.
2023-05-09 11:58:34 +03:00
Krzysztof Wolicki
a714f07022 autodoc: Fix tag type for unions; Fix backing int for packed structs 2023-05-09 10:52:51 +02:00
Krzysztof Wolicki
b488f97e92 autodoc: Analyze and expose backing integer types for packed structs 2023-05-08 22:34:46 +02:00
Jacob Young
1f5aa7747f x86_64: finish optimizing mir tag usage
Final tag count is 95.
2023-05-08 07:36:20 -04:00
Jacob Young
ecb5feaf94 x86_64: continue to optimize mir tag usage
Migrate mnemonic literals to tuples that represent the compressed
storage.  225 tags left in use, many tags left to compress.
2023-05-08 07:36:20 -04:00
Jacob Young
6c14eb2863 x86_64: optimize mir tag usage
This moves all pseudo-instructions to a single `Mir.Inst.Tag` tag and
prepares to start coalescing similar mnemonics. 239 tags left in use.
2023-05-08 07:36:20 -04:00
Jacob Young
6778da4516 x86_64: implement binary operations for f16 and f16 vectors 2023-05-08 07:36:20 -04:00
Jacob Young
f8708e2c4d x86_64: implement @floor, @ceil, and @trunc for float vectors 2023-05-08 07:36:20 -04:00
Jacob Young
057139fda5 x86_64: implement binary operations for float vectors 2023-05-08 07:36:20 -04:00
Jacob Young
ea957c4cff x86_64: implement @sqrt for f16 scalars and vectors 2023-05-08 07:36:20 -04:00
Jacob Young
5c5da179fb x86_64: implement @sqrt for vectors 2023-05-08 07:36:20 -04:00
Jacob Young
05580b9453 x86_64: implement float cast from f16 to f64 2023-05-08 07:36:20 -04:00
Jacob Young
1c53f0a6b0 Dwarf: workaround crash 2023-05-08 07:36:20 -04:00
Jacob Young
406c403543 x86_64: add missing movsx and movzx encodings 2023-05-08 07:36:20 -04:00
Jacob Young
cba195c117 x86_64: implement some float and float vector movement
This allows actually storing value of these supported types in
registers, and not restricting them to stack slots.
2023-05-08 07:36:20 -04:00
Jacob Young
3a5e3c52e0 x86_64: implement @mulAdd 2023-05-08 07:36:20 -04:00
Jacob Young
4b75352c78 x86_64: implement packed floating point fields 2023-05-08 07:36:20 -04:00
Jacob Young
5d4288c5f6 x86_64: fix unordered float equality 2023-05-08 07:36:19 -04:00
Jacob Young
ae588a09f2 x86_64: implement f16 cmp 2023-05-08 07:36:19 -04:00
Jacob Young
32ab930f1d x86_64: implement f16 conversions when supported 2023-05-08 07:36:19 -04:00
Jacob Young
1a261917ce x86_64: implement @ctz and @clz for u128 2023-05-08 07:36:19 -04:00
Jacob Young
9bea854dc2 x86_64: implement @floor, @ceil, and @trunc 2023-05-08 07:36:19 -04:00
Dominic
5a3eca5d4c
Disallow named test decls with duplicate names 2023-05-08 10:59:06 +03:00
Loris Cro
e8cc1017da
Merge pull request #15594 from der-teufel-programming/autodoc-tldocs
Autodoc: Add gathering of top-level doc comments for imported files
2023-05-07 13:58:53 +02:00
Dominic
e1f5ad3cc8
Fix parsing of hexadecimal literals 2023-05-07 08:05:53 +00:00
dweiller
cba9077cc1 sema: fix slice by length non-array, non-slice case 2023-05-07 15:55:21 +10:00
dweiller
bd3360e03d convert s[start..start+len] to s[start..][0..len] 2023-05-07 15:55:21 +10:00
dweiller
2c5924c59a autodoc: fix support for slice_length ZIR instruction 2023-05-07 15:55:21 +10:00
dweiller
64e319f555 add optional sentinel to slice_length ZIR 2023-05-07 15:55:21 +10:00
dweiller
2c2a0402c6 autodoc: implement slice_length case in walkInstruction 2023-05-07 15:55:20 +10:00
dweiller
8aa70cf6cd sema: omit extraneous addition when safety is unwanted 2023-05-07 15:55:20 +10:00
dweiller
9fb5b047e9 astgen: lower s[start..][0..len] to slice_length ZIR 2023-05-07 15:55:20 +10:00
dweiller
e58a0c5e9e sema: implement slice_length ZIR instruction 2023-05-07 15:55:20 +10:00
dweiller
a62b5d84d8 zir: add slice_length tag 2023-05-07 15:55:20 +10:00