aboutsummaryrefslogtreecommitdiff
path: root/src/stage1
AgeCommit message (Collapse)Author
2022-08-22stage2+stage1: remove type parameter from bit builtinsVeikka Tuominen
Closes #12529 Closes #12511 Closes #6835
2022-08-18std.Target gains ObjectFormat fieldAndrew Kelley
2022-08-10stage2: Implement explicit backing integers for packed structsIsaac Freund
Now the backing integer of a packed struct type may be explicitly specified with e.g. `packed struct(u32) { ... }`.
2022-08-07remove 'builtin.stage2_arch', Sema is smart enough nowMeghan Denny
2022-07-29stage1: remove deadcode ast_printWei Fu
Fixes: 2a990d696 ("stage1: rework tokenizer to match stage2") Fixes: b6354ddd5 ("move AST rendering code to separate file") Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-07-26Merge pull request #12136 from topolarity/llvm-config-reworkAndrew Kelley
CMake: Improve usage of `llvm-config` (esp. for consistent static/shared linking)
2022-07-23CMake: Add ZIG_LLVM_LINK_MODE to config.hCody Tapscott
This is currently unused, but it will be needed soon so that we can avoid linking static libc++ if LLVM/Clang is configured as a shared library.
2022-07-23Fix #6944: referencing type info alignment causes error in unrelated functionYujiri
2022-07-19delete the stage1 implementation of autodocAndrew Kelley
2022-07-11stage1: fix typo in analyze.cpp (#12077)Ikko Ashimine
accomodate -> accommodate
2022-07-10stage1: Lower libcalls on Windows x86-64 correctlyCody Tapscott
This change is the Zig counterpart to https://reviews.llvm.org/D110413 Since we lower some libcalls directly (just like clang does), we need to make sure that the ABI we call with matches the ABI of the compiler-rt we are providing (and also the ABI expected by LLVM). While I was at it, I noticed some flawed vector handling in the binary soft float ops in stage 1, so I shored up the logic a bit and expanded an existing test to cover the missing functionality.
2022-07-10stage1/codegen: replace sprintf() with snprintf()Frank Denis
Calling sprintf() is now triggering an error on Xcode 14. Using snprintf() is generally not a bad idea anyway.
2022-07-07Merge remote-tracking branch 'origin/master' into llvm14Andrew Kelley
2022-07-08stage1: Fix seg-fault when slicing string literal with sentinelCody Tapscott
2022-07-08Sema: add a note about @setEvalBranchQuota() when branch quota is exceededVÖRÖSKŐI András
closes #11996
2022-07-03stage1: fix vectors of small int and bool tripping LLVM assertionAndrew Kelley
stage2 already has this fixed; debug info is given size in bits rather than ABI size (bytes) multiplied by 8. closes #11587
2022-07-03LLVM: update lowering of saturating shift-leftAndrew Kelley
LLVM 14 makes it so that a RHS of saturating shift left produces a poison value if the value is greater than the number of bits of the LHS. Zig now emits code that will check if this is the case and select a saturated LHS value in such case, matching Zig semantics.
2022-07-01stage1: update inline asm outputs to LLVM 14Andrew Kelley
LLVM pointers are transitioning to no longer have types, however, inline assembly inputs and outputs which accept pointers need to know the element type. So, inline assembly must be upgraded to add elementtype(<ty>) annotations.
2022-07-01stage1: update to LLVM 14 APIAndrew Kelley
2022-07-01Merge remote-tracking branch 'origin/master' into llvm14Andrew Kelley
2022-06-28zig0: handle baseline cpu features for rv64Shupei Fan
2022-06-27LLVM: fix invalid IR on `@returnAddress` of wasm/bpfAndrew Kelley
see #11946
2022-05-26stage0: fix -fsingle-threaded CLI arg parsingAndrew Kelley
closes #11730
2022-05-23Fix segfault in error noteThomas Cheng
2022-05-22Set macOS/iPhoneOS/tvOS/watchOS ABI to none (unspecified) by defaultJakub Konka
Prior to this change we would assume the ABI for Apple targets to be GNU which could result in subtle errors in LLVM emitting calls to non-existent system libc provided functions such as `_sincosf` which is a GNU extension and as such is not provided by macOS for example. This would result in linker errors where the linker would not be able to find the said symbol in `libSystem.tbd`. With this change, we now correctly identify macOS (and other Apple platforms) as having ABI `unknown` which translates to unspecified in LLVM under-the-hood: ``` // main.ll target triple = "aarch64-unknown-macos-unknown" ``` Note however that we never suffix the target OS with target version such as `macos11` or `macos12` which means we fail to instruct LLVM of potential optimisations provided by the OS such as the availability of function `___sincosf_stret`. I suggest we investigate that in a follow-up commit.
2022-05-13target: Rename sparcv9 -> sparc64Koakuma
Rename all references of sparcv9 to sparc64, to make Zig align more with other projects. Also, added new function to convert glibc arch name to Zig arch name, since it refers to the architecture as sparcv9. This is based on the suggestion by @kubkon in PR 11847. (https://github.com/ziglang/zig/pull/11487#pullrequestreview-963761757)
2022-05-08Merge pull request #11609 from ziglang/win-compiler-rtAndrew Kelley
compiler-rt: avoid symbol collisions with Windows libc
2022-05-08Add Win64 calling conventionHannes Bredberg
Closes ziglang/zig#11585
2022-05-08allow in-memory coercion of differently-named floats with same bitsAndrew Kelley
For example, this allows passing a `*c_longdouble` where a `*f80` is expected, provided that `c_longdouble` maps to `f80` for this target.
2022-05-06flatten lib/std/special and improve "pkg inside another" logicAndrew Kelley
stage2: change logic for detecting whether the main package is inside the std package. Previously it relied on realpath() which is not portable. This uses resolve() which is how imports already work. * stage2: fix cleanup bug when creating Module * flatten lib/std/special/* to lib/* - this was motivated by making main_pkg_is_inside_std false for compiler_rt & friends. * rename "mini libc" to "universal libc"
2022-05-04stage1: fix `@sizeOf` for 128-bit integer typesAndrew Kelley
2022-04-27stage1: fix incorrect struct paddingAndrew Kelley
Before this change, struct {f80, f80} targeting i386-windows-msvc lowers to ```llvm %"std.testing.struct:78:61.6" = type { x86_fp80, [6 x i8], x86_fp80, [6 x i8] } ``` which has an incorrect ABI size of 40. After this change, the struct lowers to ```llvm %"std.testing.struct:78:61.6" = type { x86_fp80, [4 x i8], x86_fp80, [4 x i8] } ``` which has the correct ABI size of 32, and properly aligns the second field to 16 bytes. The other place that calculates field padding (lowering of constant values in codegen.cpp) already correctly calls LLVMABISizeOfType rather than LLVMStoreSizeOfType. This fixes the compiler-rt tests for i386-windows in this branch.
2022-04-27stage1: fix i386-windows f80 sizeof/alignofAndrew Kelley
2022-04-27stage1: add missing comptime float opsAndrew Kelley
These are only as accurate as f64 even for f128 comptime functions. This is OK for now; improvements will come with the launch of self-hosted (#89) and enhancements to compiler-rt implementations.
2022-04-27compiler-rt: avoid symbol conflictsAndrew Kelley
Weak aliases don't work on Windows, so we avoid exporting the `l` alias on this platform for functions we know will collide.
2022-04-27add new builtin function `@tan`Andrew Kelley
The reason for having `@tan` is that we already have `@sin` and `@cos` because some targets have machine code instructions for them, but in the case that the implementation needs to go into compiler-rt, sin, cos, and tan all share a common dependency which includes a table of data. To avoid duplicating this table of data, we promote tan to become a builtin alongside sin and cos. ZIR: The tag enum is at capacity so this commit moves `field_call_bind_named` to be `extended`. I measured this as one of the least used tags in the zig codebase. Fix libc math suffix for `f32` being wrong in both stage1 and stage2. stage1: add missing libc prefix for float functions.
2022-04-27stage1: Manually lower softfloat ops when neededCody Tapscott
Updates stage1 to manually lower softfloat operations for all unary floating point operations, extension/truncation, and arithmetic.
2022-04-26std.Thread: ResetEvent improvements (#11523)protty
* std: start removing redundant ResetEvents * src: fix other uses of std.Thread.ResetEvent * src: add builtin.sanitize_thread for tsan detection * atomic: add Atomic.fence for proper fencing with tsan * Thread: remove the other ResetEvent's and rewrite the current one * Thread: ResetEvent docs * zig fmt + WaitGroup.reset() fix * src: fix build issues for ResetEvent + tsan * Thread: ResetEvent tests * Thread: ResetEvent module doc * Atomic: replace llvm *p memory constraint with *m * panicking: handle spurious wakeups in futex.wait() when waiting for abort() * zig fmt
2022-04-22Merge pull request #11279 from igor84/s1_packed_structAndrew Kelley
stage1: Fix packed structs (#2627, #10104)
2022-04-18wasm: Add support for debug infoLuuk de Gram
This implements basic DWARF output when building for the wasm target. Stacktraces, however, are currently not supported.
2022-04-16stage2: fix @mulAdd on aarch64 DarwinJakub Konka
According to Apple docs, the long double type is a double precision IEEE754 binary floating-point type, which makes it identical to the double type. This behavior contrasts to the standard specification, in which a long double is a quad-precision, IEEE754 binary, floating-point type. Thus, we need to take this into account when using the compiler intrinsics so that we select the correct function version for FloatMulAdd.
2022-04-14stage2: progress towards stage3Andrew Kelley
* The `@bitCast` workaround is removed in favor of `@ptrCast` properly doing element casting for slice element types. This required an enhancement both to stage1 and stage2. * stage1 incorrectly accepts `.{}` instead of `{}`. stage2 code that abused this is fixed. * Make some parameters comptime to support functions in switch expressions (as opposed to making them function pointers). * Avoid relying on local temporaries being mutable. * Workarounds for when stage1 and stage2 disagree on function pointer types. * Workaround recursive formatting bug with a `@panic("TODO")`. * Remove unreachable `else` prongs for some inferred error sets. All in effort towards #89.
2022-04-09stage1: Additional fix for packed structsIgor Stojkovic
2022-03-27stage1: implement casting from u0leesongun
2022-03-26stage1: Fix packed structs (#2627, #10104)Igor Stojkovic
Fixed formatting in packed-struct-zig Skipped packed_structs tests in stage2 simplified packed struct tests
2022-03-19stage1: make type names more uniqueRobin Voetter
2022-03-08LLVM: memoize debug types and add enum debug typesAndrew Kelley
2022-03-08deprecated TypeInfo in favor of TypeJonathan Marler
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-03-06stage1: improved implementation of target_long_double_is_f128Andrew Kelley
2022-02-23compiler_rt: specify goals, organize README and compiler_rt.zigJan Philipp Hafer
* goals - zig as linker for object files generated by other compilers - zig-specific runtime features for eventual standardisation * changes - missing routines are marked with `missing` - structure inspired by libgcc docs, but improved order and wording - rename misspelled functions - reorder and rephrase compiler_rt.zig to reflect documentation - potential decimal float or fixed-point arithmetic support: * 'Decimal float library routines' ca. 120 functions * 'Fixed-point fractional library routines' ca. 300 functions thanks to @Vexu for multiple reviews and @scheibo for review