aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
AgeCommit message (Collapse)Author
2023-10-15spirv: constant elem ptr fixRobin Voetter
2023-10-15spirv: lower pointers to zero-bit types as undefRobin Voetter
2023-10-15spirv: opaque typesRobin Voetter
2023-10-14LLVM: work around `@floatFromInt` bugAndrew Kelley
see #17381
2023-10-13llvm: fix incorrect file paths in debug infoAndrew Kelley
The previous code incorrectly added `sub_path` twice. Also for the compilation unit, it was passing empty string to realpath, resulting in the error handling codepath being used. closes #17482
2023-10-09Merge pull request #17391 from xxxbxxx/load-i4Andrew Kelley
codegen/llvm: truncate padding bits when loading a non-byte-sized value
2023-10-08more fixes related to previous commits Package/Module APIAndrew Kelley
2023-10-08CLI: finish updating module API usageAndrew Kelley
Finish the work started in 4c4fb839972f66f55aa44fc0aca5f80b0608c731. Now the compiler compiles again. Wire up dependency tree fetching code in the CLI for `zig build`. Everything is hooked up except for `createDependenciesModule` is not yet implemented.
2023-10-08codegen/llvm: add workarounds to loadTruncate() for llvm codegen bugsXavier Bouchoux
for wasm, as a heuritic, only enable truncation for values smaller than 32bits. -> the bug is no longer triggered in most use cases (or at least the test suite...) as for powerpc, adding a redundant `and mask` produces working code.
2023-10-08codegen/llvm: truncate padding bits when loading a non-byte-sized valueXavier Bouchoux
2023-10-08llvm: fix load of packed struct that was initialized through pointersJacob Young
2023-10-08cbe: fix crash on errorJacob Young
This hashmap value used to be assigned much later during `flushModule`, which never happens if an error is returned by the backend, and attempting to the undefined values would cause a crash.
2023-10-04comp: add support for -fdata-sectionsJakub Konka
2023-10-03C backend: render anon declsAndrew Kelley
Introduce the new mechanism needed to render anonymous decls to C code that the frontend is now using. The current strategy is to collect the set of used anonymous decls into one ArrayHashMap for the entire compilation, and then render them during flush(). In the future this may need to be adjusted for incremental compilation purposes, so that removing a Decl from decl_table means that newly unused anonymous decls are no longer rendered. However, let's do one thing at a time. The only goal of this branch is to stop using Module.Decl objects for unnamed constants.
2023-10-03C backend: start handling anonymous declsAndrew Kelley
Start keeping track of dependencies on anon decls for dependency ordering during flush() Currently this causes use of undefined symbols because these dependencies need to get rendered into the output.
2023-10-03compiler: start handling anonymous decls differentlyAndrew Kelley
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-03llvm: remove extra copy of wrapped payloadsocrap7
2023-10-03Merge pull request #17375 from xxxbxxx/packed-structAndrew Kelley
codegen: fix field offsets in packed structs
2023-10-03Merge pull request #17341 from rzezeski/illumos-updatesAndrew Kelley
Illumos/Solaris updates
2023-10-03codegen: fix byte-aligned field offsets in unaligned nested packed structsXavier Bouchoux
2023-10-03codegen: fix field offsets in packed structsXavier Bouchoux
* add nested packed struct/union behavior tests * use ptr_info.packed_offset rather than trying to duplicate the logic from Sema.structFieldPtrByIndex() * use the container_ptr_info.packed_offset to account for non-aligned nested structs. * dedup type.packedStructFieldBitOffset() and module.structPackedFieldBitOffset()
2023-10-02Add illumos OS tagStephen Gregoratto
- Adds `illumos` to the `Target.Os.Tag` enum. A new function, `isSolarish` has been added that returns true if the tag is either Solaris or Illumos. This matches the naming convention found in Rust's `libc` crate[1]. - Add the tag wherever `.solaris` is being checked against. - Check for the C pre-processor macro `__illumos__` in CMake to set the proper target tuple. Illumos distros patch their compilers to have this in the "built-in" set (verified with `echo | cc -dM -E -`). Alternatively you could check the output of `uname -o`. Right now, both Solaris and Illumos import from `c/solaris.zig`. In the future it may be worth putting the shared ABI bits in a base file, and mixing that in with specific `c/solaris.zig`/`c/illumos.zig` files. [1]: https://github.com/rust-lang/libc/tree/6e02a329a2a27f6887ea86952f389ca11e06448c/src/unix/solarish
2023-10-01x86_64: implement and test unary float builtinsJacob Young
2023-09-29C backend: remove ?*Decl from DeclGenAndrew Kelley
Another simplification. DeclGen already has `decl_index` which can be used to retrieve the `*Decl` if needed.
2023-09-27Rename `@fabs` to `@abs` and accept integersantlilja
Replaces the @fabs builtin with a new @abs builtins which accepts floats, signed integers and vectors of said types.
2023-09-27C backend: flatten out some of the long-lived stateAndrew Kelley
When the compiler's state lives through multiple Compilation.update() calls, the C backend stores the rendered C source code for each decl code body and forward declarations. With this commit, the state is still stored, but it is managed in one big array list in link/C.zig rather than many array lists, one for each decl. This means simpler serialization and deserialization.
2023-09-26Merge pull request #17215 from kcbanner/read_from_memory_unionVeikka Tuominen
sema: add support for unions in readFromMemory and writeToMemory
2023-09-24cbe: support more symbol attributesMichael Dusan
implement codegen for: - decl weak linkage - decl aliases - fn decl weak linkage windows msvc: - `__declspec(selectany)` is not supported for functions - skip weak linkage for functions closes #17050
2023-09-23spirv: fixesRobin Voetter
2023-09-23spirv: air dbg_var_val and dbg_var_ptrRobin Voetter
2023-09-23spirv: fix blocks that return no valueRobin Voetter
2023-09-23spirv: fix source line numbersRobin Voetter
2023-09-23spirv: enable passing testsRobin Voetter
2023-09-23spirv: constant elem ptrRobin Voetter
2023-09-23spirv: air sliceRobin Voetter
2023-09-23spirv: air wrap_errunion_payloadRobin Voetter
2023-09-23spirv: air unwrap_errunion_payloadRobin Voetter
2023-09-23spirv: air is_err, is_non_errRobin Voetter
2023-09-23spirv: generate module initializerRobin Voetter
2023-09-23spirv: air array_elem_val using hackRobin Voetter
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-23spirv: air aggregate_init for arrayRobin Voetter
2023-09-23spirv: air array_to_sliceRobin Voetter
2023-09-23spirv: air sub_with_overflowRobin Voetter
2023-09-23spirv: air union_initRobin Voetter
2023-09-23spirv: air set_union_tag + improve load()/store()Robin Voetter
2023-09-23spirv: air struct_field_ptr for unionsRobin Voetter
2023-09-23spirv: air struct_field_val for unionsRobin Voetter
2023-09-23spirv: add names to globals and initializersRobin Voetter
2023-09-23spirv: emit OpLogical(Not)Equal for comparing boolsRobin Voetter
2023-09-23spirv: emit OpNot for arithmetic notRobin Voetter