aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
AgeCommit message (Collapse)Author
2023-10-31std.builtin.Endian: make the tags lower caseAndrew Kelley
Let's take this breaking change opportunity to fix the style of this enum.
2023-10-26link: support exporting constant values without a DeclAndrew Kelley
The main motivating change here is to prevent the creation of a fake Decl object by the frontend in order to `@export()` a value. Instead, `link.updateDeclExports` is renamed to `link.updateExports` and accepts a tagged union which can be either a Decl.Index or a InternPool.Index.
2023-10-25C backend: remove some `@as`Andrew Kelley
2023-10-25cbe: update `DeclGen.decl_index` to support anon declsJacob Young
2023-10-24InternPool: remove runtime_value representationmlugg
The main goal of this commit is to remove the `runtime_value` field from `InternPool.Key` (and its associated representation), but there are a few dominos. Specifically, this mostly eliminates the "maybe runtime" concept from value resolution in Sema: so some resolution functions like `resolveMaybeUndefValAllowVariablesMaybeRuntime` are gone. This required a small change to struct/union/array initializers, to no longer use `runtime_value` if a field was a `variable` - I'm not convinced this case was even reachable, as `variable` should only ever exist as the trivial value of a global runtime `var` decl. Now, the only case in which a `Sema.resolveMaybeUndefVal`-esque function can return the `variable` key is `resolveMaybeUndefValAllowVariables`, which is directly called from `Sema.resolveInstValueAllowVariables` (previously `Sema.resolveInstValue`), which is only used for resolving the value of a Decl from `Module.semaDecl`. While changing these functions, I also slightly reordered and restructured some of them, and updated their doc comments.
2023-10-23Revert "Revert "Merge pull request #17657 from Snektron/spirv-recursive-ptrs""Robin Voetter
This reverts commit 9f0359d78f9facc38418e32b0e8c1bf6f99f0d26 in an attempt to make the tests pass again. The CI failure from that merge should be unrelated to this commit.
2023-10-23Merge pull request #17651 from Vexu/error-limitAndrew Kelley
Make distinct error limit configurable (attempt #2)
2023-10-22Revert "Merge pull request #17657 from Snektron/spirv-recursive-ptrs"Andrew Kelley
This reverts commit b822e841cda0adabe3fec260ff51c18508f7ee32, reversing changes made to 0c99ba1eab63865592bb084feb271cd4e4b0357e. This caused a CI failure when it landed in master branch.
2023-10-22Merge pull request #17657 from Snektron/spirv-recursive-ptrsRobin Voetter
spirv: recursive pointers
2023-10-22remove uses of non-configurable `err_int`Veikka Tuominen
2023-10-21InternPool: store alignment of anon declsAndrew Kelley
Commit 5393e56500d499753dbc39704c0161b47d1e4d5c has a flaw pointed out by @mlugg: the `ty` field of pointer values changes when comptime values are pointer-casted. This commit introduces a new encoding which additionally stores the "original pointer type" which is used to store the alignment of the anonymous decl, and potentially other information in the future such as section and pointer address space. However, this new encoding is only used when the original pointer type differs from the casted pointer type in a meaningful way. I was able to make the LLVM backend and the C backend lower anonymous decls with the appropriate alignment, however I will need some help figuring out how to do this for the backends that lower anonymous decls via src/codegen.zig and the wasm backend.
2023-10-21migrate make_ptr_const to new anonymous decl mechanismAndrew Kelley
Instead of creating Module.Decl objects, directly create InternPool pointer values using the anon_decl Addr encoding. The LLVM backend needed code to notice the alignment of the pointer and lower accordingly. The other backends likely need a similar change.
2023-10-21spirv: self-referential pointers via new fwd_ptr_typeRobin Voetter
Its a little ugly but it works.
2023-10-21spirv: make constructStruct also use self.ptrTypeRobin Voetter
This completes the migration from spv.ptrType to self.ptrType. Unfortunately this requires us to pass a list of types to constructStruct, which also requires some extra allocations here and there.
2023-10-21spirv: improve union operationsRobin Voetter
This removes the strategy where union with different active fields would be generated, and instead simply pointer casts the active field type where required. This also allows removing spv.ptrType and using self.ptrType instead, and allows caching all union types (because there is only the canonical one).
2023-10-21spirv: make load() and store() accept MemoryOptionsRobin Voetter
This struct is used to configure the load, such as to make it volatile. Previously this was done using a single bool, but this struct makes it shorter to write non-volatile loads (the usual) and more clear whats going on when a volatile load is required.
2023-10-21spirv: replace most use of spv.ptrType with self.ptrTypeRobin Voetter
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-19link: initialize llvm before calling the llvm APIJacob Young
2023-10-19Builder: fix incorrect type for 32-bit systemsJacob Young
2023-10-18Merge pull request #17577 from alichraghi/spirv-1Robin Voetter
spirv: switch on bool
2023-10-18Merge pull request #17561 from alichraghi/spirv-0Robin Voetter
spirv: memcpy
2023-10-18spirv: switch on boolAli Chraghi
2023-10-17spirv: memcpyAli Chraghi
2023-10-16spirv: fieldParentPtrAli Chraghi
2023-10-15spirv: work around OpSource parsing issue in llvm-spirvRobin Voetter
The Khronos SPIRV-LLVM translator does not parse OpSource correctly. This was causing tests to fail and other mysterious issues. These are resolved by only generating a single OpSource instruction for now, which does not have the source file locations also. See https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/2188
2023-10-15spirv: simple binary and comparison vector operationsAli Chraghi
2023-10-15spirv: emit vectors as arraysAli Chraghi
2023-10-15spirv: optional comparisonRobin Voetter
2023-10-15spirv: handle errors in switchRobin Voetter
2023-10-15spirv: intcast, trunc for strange intsRobin Voetter
2023-10-15spirv: sign-extension for strange integersRobin Voetter
2023-10-15spirv: air min/maxRobin Voetter
2023-10-15spirv: air bitcast for non-numeric non-pointer typesRobin Voetter
2023-10-15spirv: fix air is_null optional slice field typeRobin Voetter
2023-10-15spirv: allow generation of *i0Robin Voetter
2023-10-15spirv: handle zero-sized arraysRobin Voetter
2023-10-15spirv: `fpext` and `fptrunc` instructionsAli Chraghi
2023-10-15spirv: override function return type to void if it has no runtime bitsRobin Voetter
2023-10-15spirv: generate *void as pointer to opaqueRobin Voetter
2023-10-15spirv: make air is_null not emit OpPtr(Not)EqualRobin Voetter
2023-10-15spirv: fix incorrect repr of some optional operationsRobin Voetter
2023-10-15spirv: make bitcasts between the same spirv type a no-opRobin Voetter
2023-10-15spirv: fix float unequalityRobin Voetter
2023-10-15spirv: properly skip comptime function parametersRobin Voetter
2023-10-15spirv: aggregate_init for structsRobin Voetter
2023-10-15spirv: put linkery bits in ObjectRobin Voetter
This structure is used to group information that needs to persist between decls in codegen.
2023-10-15spirv: use CacheString for source_file_names instead of []const u8Robin Voetter
2023-10-15spirv: get rid of SpvModule arenaRobin Voetter
2023-10-15spirv: anon decl refsRobin Voetter
2023-10-15spirv: cast result of .elem pointers to right type if neededRobin Voetter