Commit Graph

262 Commits

Author SHA1 Message Date
Robin Voetter
200bca360e spirv: replace most use of spv.ptrType with self.ptrType
To support self-referential pointers, in the future we will
need to pass the Zig type to any pointer that is created. This
lays some ground work for that by replacing most uses of
spv.ptrType with a new ptrType function that also accepts the
Zig type. This function's contents will soon be replaced by
a version that also supports self-referential pointers.

Also fixed some bugs regarding the use of direct/indirect.
2023-10-21 17:46:50 +02:00
Robin Voetter
c3120d5089 Merge pull request #17577 from alichraghi/spirv-1
spirv: switch on bool
2023-10-18 16:28:13 +02:00
Robin Voetter
24b065a6a8 Merge pull request #17561 from alichraghi/spirv-0
spirv: memcpy
2023-10-18 15:38:30 +02:00
Ali Chraghi
e5d5c1d423 spirv: switch on bool 2023-10-18 02:31:16 +03:30
Ali Chraghi
6d8a979265 spirv: memcpy 2023-10-17 13:02:30 +03:30
Ali Chraghi
e44152e252 spirv: fieldParentPtr 2023-10-16 20:27:28 -04:00
Ali Chraghi
45a1945dc4 spirv: simple binary and comparison vector operations 2023-10-15 14:00:33 +02:00
Ali Chraghi
2fe16e072a spirv: emit vectors as arrays 2023-10-15 14:00:32 +02:00
Robin Voetter
f4064d98e2 spirv: optional comparison 2023-10-15 14:00:31 +02:00
Robin Voetter
10b8171466 spirv: handle errors in switch 2023-10-15 14:00:30 +02:00
Robin Voetter
e2e4e1f8b4 spirv: intcast, trunc for strange ints 2023-10-15 14:00:10 +02:00
Robin Voetter
b1499df1b8 spirv: sign-extension for strange integers 2023-10-15 14:00:09 +02:00
Robin Voetter
4f279078c8 spirv: air min/max 2023-10-15 14:00:07 +02:00
Robin Voetter
f858bf1616 spirv: air bitcast for non-numeric non-pointer types 2023-10-15 14:00:07 +02:00
Robin Voetter
0af16a58a0 spirv: fix air is_null optional slice field type 2023-10-15 14:00:06 +02:00
Robin Voetter
d0e7a3596b spirv: allow generation of *i0 2023-10-15 14:00:06 +02:00
Robin Voetter
2d52fc762d spirv: handle zero-sized arrays 2023-10-15 14:00:05 +02:00
Ali Chraghi
d8b591766a spirv: fpext and fptrunc instructions 2023-10-15 14:00:04 +02:00
Robin Voetter
d2692af8e2 spirv: override function return type to void if it has no runtime bits 2023-10-15 14:00:04 +02:00
Robin Voetter
ae3efab226 spirv: generate *void as pointer to opaque 2023-10-15 14:00:03 +02:00
Robin Voetter
fe51ff9fc1 spirv: make air is_null not emit OpPtr(Not)Equal 2023-10-15 14:00:03 +02:00
Robin Voetter
15cf1315bb spirv: fix incorrect repr of some optional operations 2023-10-15 14:00:01 +02:00
Robin Voetter
0a3e566f57 spirv: make bitcasts between the same spirv type a no-op 2023-10-15 14:00:01 +02:00
Robin Voetter
c6c5fb40de spirv: fix float unequality 2023-10-15 14:00:00 +02:00
Robin Voetter
4a6a024a4b spirv: properly skip comptime function parameters 2023-10-15 14:00:00 +02:00
Robin Voetter
89b1dafa78 spirv: aggregate_init for structs 2023-10-15 13:59:55 +02:00
Robin Voetter
28dda3bf89 spirv: put linkery bits in Object
This structure is used to group information that needs to
persist between decls in codegen.
2023-10-15 13:59:26 +02:00
Robin Voetter
31ad2d72a7 spirv: use CacheString for source_file_names instead of []const u8 2023-10-15 13:59:26 +02:00
Robin Voetter
ab701c3d37 spirv: anon decl refs 2023-10-15 13:59:24 +02:00
Robin Voetter
08ea9a9ff6 spirv: cast result of .elem pointers to right type if needed 2023-10-15 13:59:23 +02:00
Robin Voetter
a7c3d5e4ec spirv: constant elem ptr fix 2023-10-15 13:59:22 +02:00
Robin Voetter
4ea361f6dc spirv: lower pointers to zero-bit types as undef 2023-10-15 13:59:22 +02:00
Robin Voetter
4e22f811e7 spirv: opaque types 2023-10-15 13:59:20 +02:00
Andrew Kelley
c0b5512544 compiler: start handling anonymous decls differently
Instead of explicitly creating a `Module.Decl` object for each anonymous
declaration, each `InternPool.Index` value is implicitly understood to
be an anonymous declaration when encountered by backend codegen.

The memory management strategy for these anonymous decls then becomes to
garbage collect them along with standard InternPool garbage.

In the interest of a smooth transition, this commit only implements this
new scheme for string literals and leaves all the previous mechanisms in
place.
2023-10-03 12:12:50 -07:00
Robin Voetter
cff8ab88f5 spirv: fixes 2023-09-23 12:36:56 -07:00
Robin Voetter
572517376a spirv: air dbg_var_val and dbg_var_ptr 2023-09-23 12:36:56 -07:00
Robin Voetter
68c7fc5c59 spirv: fix blocks that return no value 2023-09-23 12:36:56 -07:00
Robin Voetter
63512192de spirv: fix source line numbers 2023-09-23 12:36:56 -07:00
Robin Voetter
075584a4d7 spirv: enable passing tests 2023-09-23 12:36:56 -07:00
Robin Voetter
d9a8c779d8 spirv: constant elem ptr 2023-09-23 12:36:56 -07:00
Robin Voetter
a75300c8d8 spirv: air slice 2023-09-23 12:36:56 -07:00
Robin Voetter
8895025688 spirv: air wrap_errunion_payload 2023-09-23 12:36:56 -07:00
Robin Voetter
4f215a6d28 spirv: air unwrap_errunion_payload 2023-09-23 12:36:56 -07:00
Robin Voetter
48ab11639a spirv: air is_err, is_non_err 2023-09-23 12:36:56 -07:00
Robin Voetter
b845c9d532 spirv: generate module initializer 2023-09-23 12:36:56 -07:00
Robin Voetter
5d844faf7c spirv: air array_elem_val using hack
SPIR-V doesn't support true element indexing, so we probably
need to switch over to isByRef like in llvm for this to work
properly. Currently a temporary is used, which at least
seems to work.
2023-09-23 12:36:56 -07:00
Robin Voetter
26c279cca2 spirv: air aggregate_init for array 2023-09-23 12:36:56 -07:00
Robin Voetter
8d49b2ef4e spirv: air array_to_slice 2023-09-23 12:36:56 -07:00
Robin Voetter
66b1f6c163 spirv: air sub_with_overflow 2023-09-23 12:36:56 -07:00
Robin Voetter
749307dbb2 spirv: air union_init 2023-09-23 12:36:56 -07:00