Commit Graph

247 Commits

Author SHA1 Message Date
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
Robin Voetter
98046b4c3c spirv: air set_union_tag + improve load()/store() 2023-09-23 12:36:56 -07:00
Robin Voetter
6f55a68964 spirv: air struct_field_ptr for unions 2023-09-23 12:36:56 -07:00
Robin Voetter
5dffbf32bf spirv: air struct_field_val for unions 2023-09-23 12:36:56 -07:00
Robin Voetter
decdedf97d spirv: add names to globals and initializers 2023-09-23 12:36:56 -07:00
Robin Voetter
924235a023 spirv: emit OpLogical(Not)Equal for comparing bools 2023-09-23 12:36:56 -07:00
Robin Voetter
c7c0517ac0 spirv: emit OpNot for arithmetic not 2023-09-23 12:36:56 -07:00
Robin Voetter
5141b4e05c spirv: fix store of undef 2023-09-23 12:36:56 -07:00
Robin Voetter
f16d1603ab spirv: fix type_map use-after-realloc issues 2023-09-23 12:36:44 -07:00
Robin Voetter
42226fc1b7 spirv: make construct(Struct|Array) use the Function storage class 2023-09-23 12:36:44 -07:00
Robin Voetter
06d9e3b2eb spirv: always emit unsigned integers
This is required for SPIR-V in Kernel mode. The Intel
implementation just didn't care about this fact.
2023-09-23 12:36:44 -07:00
Robin Voetter
18d0909ada spirv: fixes 2023-09-23 12:36:44 -07:00
Robin Voetter
66036e6000 spirv: remove indirect constant lowering
It is stupid and I hate it.
2023-09-23 12:36:44 -07:00
Robin Voetter
b30cd67987 spirv: put global var initializers in functions 2023-09-23 12:36:44 -07:00
Robin Voetter
240f9d740d spirv: lower union initialization at runtime 2023-09-23 12:36:44 -07:00
Robin Voetter
d06862b759 spirv: lower struct aggregate initialization at runtime 2023-09-23 12:36:44 -07:00