aboutsummaryrefslogtreecommitdiff
path: root/src/TypedValue.zig
AgeCommit message (Collapse)Author
2022-07-30stage2: Fix AIR printingCody Tapscott
Packed structs never have comptime fields, and a slice might actually be backed by a variable, which we need to catch before iterating its elements.
2022-07-08stage2: Fix panic when printing AIR for tuple/anon struct typesCody Tapscott
2022-07-07stage2: make line field of `@src` runtime knownVeikka Tuominen
2022-06-30move passing stage1 compile error tests to stage2Veikka Tuominen
2022-06-28TypedValue: fix print functionAndrew Kelley
for optional_payload_ptr and eu_payload_ptr
2022-06-11stage2: improve debugging toolsVeikka Tuominen
llvm: dump failed module when -femit-llvm-ir set print_air: * print fully qualified name * use Type.fmt and Value.fmtValue, fmtDebug is useless TypedValue * handle anon structs and tuples * fix bugs
2022-06-06stage2: use correct type (u29) for alignmentVeikka Tuominen
2022-06-06Sema: validate equality on store to comptime fieldVeikka Tuominen
2022-05-24stage2: string literal interningAndrew Kelley
This is a temporary addition to stage2 in order to match stage1 behavior, however the end-game once the lang spec is settled will be to use a global InternPool for comptime memoized objects, making this behavior consistent across all types, not only string literals. Or, we might decide to not guarantee string literals to have equal comptime pointers, in which case this commit can be reverted.
2022-05-20Sema: introduce laziness to `@sizeOf`Andrew Kelley
Motivation: the behavior test that is now passing. The main change in this commit is introducing `Type.abiSizeAdvanced`, `Value.Tag.lazy_size`, and adjusting `Sema.zirSizeOf` to take advantage of these. However, the bulk of lines changed in this commit ended up being moving logic from value.zig and type.zig into Sema.zig. This logic had no business being in Type/Value as it was only called from a Sema context, and we need access to the Sema context for error reporting when a lazy Value is resolved. Also worth mentioning is that I bumped up the comptime `@floatToInt` implementation from using f64 to f128.
2022-04-28TypedValue: pretty print slicesVeikka Tuominen
2022-04-20stage2: use indexes for Decl objectsAndrew Kelley
Rather than allocating Decl objects with an Allocator, we instead allocate them with a SegmentedList. This provides four advantages: * Stable memory so that one thread can access a Decl object while another thread allocates additional Decl objects from this list. * It allows us to use u32 indexes to reference Decl objects rather than pointers, saving memory in Type, Value, and dependency sets. * Using integers to reference Decl objects rather than pointers makes serialization trivial. * It provides a unique integer to be used for anonymous symbol names, avoiding multi-threaded contention on an atomic counter.
2022-03-22stage2: lazy `@alignOf`Andrew Kelley
Add a `target` parameter to every function that deals with Type and Value.
2022-03-21stage2: add way to print values with typesVeikka Tuominen
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-10-05stage2: enum fixesAndrew Kelley
* Sema: fix a missing copy on enum tag values * LLVM backend: fix lowering of enum constant values for enums with specified tag values. * Value: fix enumToInt for `enum_numbered` cases. The float widening behavior tests which rely on compiler-rt symbols are now passing.
2021-08-21stage2: comptime function with the same args is memoizedAndrew Kelley
* Introduce `memoized_calls` to `Module` which stores all the comptime function calls that are cached. It is keyed on the `*Fn` and the comptime arguments, but it does not yet properly detect comptime function pointers and avoid memoizing in this case. So it will have false positives for when a comptime function call mutates data through a pointer parameter. * Sema: Add a new helper function: `resolveConstMaybeUndefVal` * Value: add `enumToInt` method and use it in `zirEnumToInt`. It is also used by the hashing function. * Value: fix representation of optionals to match error unions. Previously it would not handle nested optionals correctly. Now it matches the memory layout of error unions and supports nested optionals properly. This required changes in all the backends for generating optional constants. * TypedValue gains `eql` and `hash` methods. * Value: Implement hashing for floats, optionals, and enums. Additionally, the zig type tag is added to the hash, where it was not previously, so that values of differing types will get different hashes.
2020-09-21rename src-self-hosted/ to src/Andrew Kelley