aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.zig
AgeCommit message (Collapse)Author
2024-01-01frontend: fix handling of special builtin moduleAndrew Kelley
it's allocated differently and imported differently
2024-01-01fix a round of compile errors caused by this branchAndrew Kelley
2024-01-01compiler: update references to targetAndrew Kelley
2024-01-01update references to module (to be renamed to zcu)Andrew Kelley
2024-01-01compiler: update references to single_threadedAndrew Kelley
2023-12-04x86_64: implement more operations on vectors with 1-bit elementsJacob Young
2023-12-03x86_64: implement more compliant vectorsJacob Young
2023-12-01test: test with `-fstrip` and fix failuresJacob Young
Closes #17513
2023-11-26move Module.Decl.Index and Module.Namespace.Index to InternPoolMeghan Denny
2023-11-25convert `toType` and `toValue` to `Type.fromInterned` and `Value.fromInterned`Techatrix
2023-11-19compiler: correct unnecessary uses of 'var'mlugg
2023-11-12x86_64: resolve tlv references on first use and spill to the stackJacob Young
This avoids any arbitrary memory operand possibly clobbering rax and sometime rdi with no warning.
2023-11-12elf: set symbol flags such as needs_zig_got in ZigObjectJakub Konka
2023-11-04Merge pull request #17844 from ziglang/elf-objectJakub Konka
elf: handle emitting relocatables and static libraries - humble beginnings
2023-11-04elf: postpone creation of .got.zig entry until code emitJakub Konka
2023-11-04elf: make sure we never emit .got.zig relocs when linking object filesJakub Konka
2023-11-03x86_64: fix std test failuresJacob Young
2023-10-30elf: move incremental codegen bits into ZigObject.zigJakub Konka
2023-10-30elf: rename ZigModule to ZigObjectJakub Konka
2023-10-30coff: implement enough of extern handling to pass comptime export testsJakub Konka
2023-10-30macho: implement enough of extern handling to pass comptime export testsJakub Konka
2023-10-28x86_64: no more load/lea_symbol weirdnessJakub Konka
2023-10-28elf: set needs_got on generated extern varsJakub Konka
2023-10-28x86_64: rename load/lea_memory to load/lea_symbolJakub Konka
2023-10-28x86_64: do not hardcode memory passed by Elf linkerJakub Konka
2023-10-25x86_64: pass more testsJacob Young
* 128-bit integer multiplication with overflow * more instruction encodings used by std inline asm * implement the `try_ptr` air instruction * follow correct stack frame abi * enable full panic handler * enable stack traces
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-23Merge pull request #17651 from Vexu/error-limitAndrew Kelley
Make distinct error limit configurable (attempt #2)
2023-10-22Revert "Revert "Merge pull request #17637 from jacobly0/x86_64-test-std""Jacob Young
This reverts commit 6f0198cadbe29294f2bf3153a27beebd64377566.
2023-10-22Revert "Merge pull request #17637 from jacobly0/x86_64-test-std"Andrew Kelley
This reverts commit 0c99ba1eab63865592bb084feb271cd4e4b0357e, reversing changes made to 5f92b070bf284f1493b1b5d433dd3adde2f46727. This caused a CI failure when it landed in master branch due to a 128-bit `@byteSwap` in std.mem.
2023-10-22Merge pull request #17637 from jacobly0/x86_64-test-stdJacob Young
x86_64: start to enable `test-std` and `test-compiler-rt` testing
2023-10-22remove uses of non-configurable `err_int`Veikka Tuominen
2023-10-21codegen: implement lowering aligned anon declsJacob Young
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-21x86_64: disable difficult std tests and hack around more zero-bit typesJacob Young
2023-10-16codegen: refactor .actual_got into .extern_gotJakub Konka
2023-10-16codegen+elf: check if extern is a variable refJakub Konka
2023-10-16codegen+elf: lower imported data refsJakub Konka
2023-10-16x86_64: add -fPIC support targeting ELFJakub Konka
2023-10-16elf: create new synthetic section ZigGotSectionJakub Konka
2023-10-05plan9: refactor debug infoJacob Young
The main goal is to stop depending on `emit.lower.target`.
2023-10-03codegen: separate getAnonDeclVAddr into lowerAnonDecl and the formerJakub Konka
Implement the stub for Elf. I believe that separating the concerns, namely, having an interface function that is responsible for signalling the linker to lower the anon decl only, and a separate function to obtain the decl's vaddr is preferable since it allows us to handle codegen errors in a simpler way.
2023-10-03link: stub out getAnonDeclVAddrAndrew Kelley
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-09-23codegen/sema: handle unions with unknown tags in more placeskcbanner
2023-09-23sema: rework the comptime representation of comptime unionskcbanner
When the tag is not known, it's set to `.none`. In this case, the value is either an array of bytes (for extern unions) or an integer (for packed unions).
2023-09-23sema: add support for unions in readFromMemory and writeToMemorykcbanner
2023-09-21compiler: fix compilation for 32-bit targetsAndrew Kelley
2023-09-21compiler: move struct types into InternPool properAndrew Kelley
Structs were previously using `SegmentedList` to be given indexes, but were not actually backed by the InternPool arrays. After this, the only remaining uses of `SegmentedList` in the compiler are `Module.Decl` and `Module.Namespace`. Once those last two are migrated to become backed by InternPool arrays as well, we can introduce state serialization via writing these arrays to disk all at once. Unfortunately there are a lot of source code locations that touch the struct type API, so this commit is still work-in-progress. Once I get it compiling and passing the test suite, I can provide some interesting data points such as how it affected the InternPool memory size and performance comparison against master branch. I also couldn't resist migrating over a bunch of alignment API over to use the log2 Alignment type rather than a mismash of u32 and u64 byte units with 0 meaning something implicitly different and special at every location. Turns out you can do all the math you need directly on the log2 representation of alignments.
2023-09-13elf: do not store Symbol's index in SymbolJakub Konka