Jacob Young
e3b8658e65
cbe: add forward declarations for optionals and error unions
...
Arrays will have to wait for type rewrite.
2022-12-03 21:58:18 -05:00
Jacob Young
6d1292552e
cbe: implement function alignment
2022-12-03 08:40:08 -05:00
Jacob Young
ec3116f573
cbe: fix zero-bit struct field pointer
2022-12-03 08:40:08 -05:00
Jacob Young
7fb6eb3d14
cbe: implement multiple exports of a symbols
2022-12-03 08:21:03 -05:00
Jacob Young
81c271cc62
cbe: don't emit extern decls that are already exported
2022-12-03 08:21:03 -05:00
Jacob Young
2cfc08ba0d
cbe: fix named constraints without modifiers
2022-12-03 08:21:03 -05:00
Andrew Kelley
f68bfe2eb7
CBE: no braces when lowering block instruction
...
This change alone solves the bracket-depth issue when compiling zig1.c
with Clang.
2022-12-03 05:22:50 -05:00
Andrew Kelley
610d604f5b
Merge pull request #13748 from jacobly0/c-unaligned
...
cbe: use memcpy for underaligned loads and stores
2022-12-03 02:18:07 -05:00
Jacob Young
e1216077f0
cbe: add support for constraint modifiers specified after a colon
...
This translates `%[name:mod]` to `%mod[name]` for C.
2022-12-02 22:21:24 -05:00
Jacob Young
fdedd62365
cbe: use memcpy for underaligned loads and stores
2022-12-02 22:21:24 -05:00
Andrew Kelley
29e8e67a7e
CBE: use bool, true, false, instead of zig_ prefixes
...
In general the C backend should lower to human-maintainable C code
whenever possible. Directly using C types that one would use when
writing C code is one part of the strategy.
The concern with including stdint.h is C89 compatibility. Well, we can
just check the C std lib version before deciding to include that header.
2022-12-02 16:12:49 -07:00
Andrew Kelley
d171279d79
CBE: use a 0 literal instead of error.@"(no error)"
...
This saves bytes and is easier to read too.
2022-12-02 15:42:20 -07:00
Andrew Kelley
665eba93c1
CBE: eliminate zig_void
...
C void is perfectly fine.
2022-12-02 00:46:27 -05:00
Veikka Tuominen
f8b779c114
cbe: write more instructions inline
2022-11-30 17:13:56 +02:00
Veikka Tuominen
11ec7109c3
cbe: do not memcpy identical integer types when bitcasting
2022-11-30 17:11:06 +02:00
Veikka Tuominen
15cc83e27a
cbe: reduce amount of temporary locals
2022-11-30 17:11:06 +02:00
Veikka Tuominen
7be6f352e3
cbe: fix asm return values
2022-11-30 15:14:34 +02:00
Veikka Tuominen
3281494dc5
cbe: prevent access of inactive union field in unimplemented instructions
2022-11-30 15:14:34 +02:00
Veikka Tuominen
a67ea4a4ae
cbe: include hash in tuple type name
...
Different (simple) tuple types do not necessarily print out as different strings.
This is issue would be caused by passing std.fmt.Formatter to std.fmt.format.
2022-11-30 15:14:33 +02:00
Veikka Tuominen
2dcac348e5
cbe: implement packed unions
2022-11-30 15:14:33 +02:00
Veikka Tuominen
1a1a5702ab
cbe: correctly handle pointers to zero bit error union payloads
2022-11-30 15:14:33 +02:00
Veikka Tuominen
4def9c4a9b
cbe: operand of address of operator must be an lvalue
2022-11-30 15:14:33 +02:00
Veikka Tuominen
6310186d52
cbe: cast pointer switch target to int
2022-11-30 15:14:33 +02:00
Veikka Tuominen
63ae7899ae
cbe: ensure test and tagName function names are unique
2022-11-30 15:14:33 +02:00
Andrew Kelley
ceb0a632cf
std.mem.Allocator: allow shrink to fail
...
closes #13535
2022-11-29 23:30:38 -07:00
Andrew Kelley
30eb2a1753
Merge pull request #13627 from Vexu/tuple-decls
...
Implement tuple type declarations
2022-11-25 18:06:09 -05:00
Andrew Kelley
8fe3d67c79
work around stage1 compile error
2022-11-23 12:21:45 -07:00
Veikka Tuominen
d5da2a6114
Sema: implement tuple declarations
2022-11-23 12:13:39 +02:00
Andrew Kelley
4ec27a4e25
C backend: implement vector reduce and overflow intrinsics
2022-11-22 23:33:58 -07:00
Jimmi Holst Christensen
adc3fafbc0
c backend: Output string literals for array init of bytes
2022-11-19 11:59:33 -05:00
Stevie Hryciw
04f3067a79
run zig fmt on everything checked by CI
2022-11-18 19:22:42 +00:00
Jacob Young
3ae04ed949
cbe: fix identifiers colliding with the short keyword
2022-11-16 01:26:37 -05:00
Jacob Young
a9c005e0e4
cbe: fixed tagged union initializers of a zero-bit field type
...
Fixes missing braces warnings on gcc 11.3.0.
2022-11-15 23:33:48 -05:00
Jacob Young
b82aec5a15
cbe: fix indexing with a zero-bit element type
...
Fixes void dereference warnings on gcc 11.3.0.
2022-11-15 23:33:48 -05:00
Jacob Young
b5b507a742
zig.h: match float comparison signatures from compiler rt
2022-11-15 23:33:48 -05:00
Jacob Young
f02b8a9cca
cbe: fix padding bits after a bitcast
2022-11-02 23:00:10 -04:00
Jacob Young
085f6fd8f7
cbe: use wrapping for left shifts
2022-11-02 23:00:10 -04:00
Jacob Young
4537c1b8b6
cbe: fix crash rendering union with zero-bit tag
2022-11-02 21:42:40 -04:00
Jacob Young
fa46f9a3d7
cbe: fix extern
2022-11-02 21:42:40 -04:00
Jacob Young
37c104ade0
cbe: ignore comptime fields when generating tuple typedefs
...
This vastly reduces the amount of deduplication state we need to deal with.
2022-11-02 10:21:05 -04:00
Jacob Young
5f31070b8b
cbe: hack around invalid Air
...
Can be changed to `!inst_ty.hisRuntimeBitsIgnoreComptime()` when the
"result location with inferred type ends up being pointer to comptime_int"
test stops producing Air containing a `bitcast(*comptime_int, ...)`.
See #13410
2022-11-02 10:20:31 -04:00
Jacob Young
d8635af1dc
cbe: correctly implement volatile memset
2022-11-01 20:43:54 -04:00
Jacob Young
4d594090b1
cbe: incorrectly implement volatile memset
...
This will have to be replaced with manual volatile stores.
2022-11-01 20:39:06 -04:00
Jacob Young
09763435a8
cbe: support arrays in more places
2022-11-01 20:39:06 -04:00
Jacob Young
071404ff65
cbe: fix optional access
2022-11-01 20:39:05 -04:00
Jacob Young
8e52be1602
cbe: avoid emitting code for zero-bit field access
2022-11-01 20:38:52 -04:00
Jacob Young
fb8c08d4ac
cbe: disambiguate struct typedefs with decl index
2022-11-01 20:38:52 -04:00
Jacob Young
91fe0b80a2
cbe: fix threadlocal
2022-11-01 20:38:51 -04:00
Jacob Young
ff83296256
cbe: fix gcc warnings
2022-10-31 21:01:47 -04:00
Jacob Young
b945d3eb90
cbe: improve support for non-native float types
...
* Fix _start on aarch64.
* Add fallbacks when a float type is unsupported.
Fixes #13357
2022-10-31 20:18:15 -04:00