aboutsummaryrefslogtreecommitdiff
path: root/test/stage2
AgeCommit message (Collapse)Author
2022-08-17Sema: allow empty enums and unionsVeikka Tuominen
2022-07-23Sema: add some more 'declared here' notesVeikka Tuominen
2022-07-21Sema: more union and enum tag type validationVeikka Tuominen
2022-07-21Sema: explain why comptime is neededVeikka Tuominen
2022-07-01Sema: validate `@intToEnum` int operand typeVeikka Tuominen
2022-06-30move passing stage1 compile error tests to stage2Veikka Tuominen
2022-06-09remove a stage2 test case that relies on a very deep compiler stackAndrew Kelley
It's causing Drone CI failure on aarch64. I will open a follow-up issue to track this missing test case.
2022-04-28test: migrate llvm incremental testsJakub Konka
2022-04-28test: migrate plan9 and sparcv9 incremental testsJakub Konka
2022-04-28test: migrate arm incremental testsJakub Konka
2022-04-28test: migrate aarch64 incremental testsJakub Konka
2022-04-28test: migrate riscv64 incremental testsJakub Konka
2022-04-28test: migrate wasm incremental testsJakub Konka
2022-04-28test: remove incremental tests that were ported to the new harnessJakub Konka
2022-04-14stage2: zig fmtKoakuma
2022-04-14stage2: Adjust line numbers in testsKoakuma
2022-04-14stage2: sparcv9: Add simple test caseKoakuma
2022-03-22fix merge conflicts and test casesAndrew Kelley
2022-03-20add error when binary ops don't have matching whitespace on both sidesDaniel Hooper
This change also moves the warning about "&&" from the AstGen into the parser so that the "&&" warning can supersede the whitespace warning.
2022-03-17stage2 test harness: ask for the backend explicitlyAndrew Kelley
Follow-up to 35d6ee08c468642969b594b711dd6448bbaefa89
2022-03-12stage2: add compiler test to ensure typed null doesn't coerce to anyMitchell Hashimoto
In stage1, this behavior was allowed (by accident?) and also accidentally exercised by the behavior test changed in this commit. In discussion on Discord, Andrew decided this should not be allowed in stage2 since there is currently on real world reason to allow this strange edge case. I've added the compiler test to solidify that this behavior should NOT occur and updated the behavior test to the new valid semantics.
2022-03-12fix nvptx test failure #10968Guillaume Wenzek
allow test cases to chose wether to link libc or not. default behavior is to not link libc, except for `exeUsingLLVMBackend`
2022-03-11stage2: passing threadlocal tests for x86_64-linuxAndrew Kelley
* use the real start code for LLVM backend with x86_64-linux - there is still a check for zig_backend after initializing the TLS area to skip some stuff. * introduce new AIR instructions and implement them for the LLVM backend. They are the same as `call` except with a modifier. - call_always_tail - call_never_tail - call_never_inline * LLVM backend calls hasRuntimeBitsIgnoringComptime in more places to avoid unnecessarily depending on comptimeOnly being resolved for some types. * LLVM backend: remove duplicate code for setting linkage and value name. The canonical place for this is in `updateDeclExports`. * LLVM backend: do some assembly template massaging to make `%%` rendered as `%`. More hacks will be needed to make inline assembly catch up with stage1.
2022-03-10stage2: error_set_merged type equalityMitchell Hashimoto
This implements type equality for error sets. This is done through element-wise error set comparison. Inferred error sets are always distinct types and other error sets are always sorted. See #11022.
2022-03-03stage2: add 'called from here' error noteVeikka Tuominen
2022-02-21enable Gpu address spaces (#10884)gwenzek
2022-02-17parser: make some errors point to end of previous tokenVeikka Tuominen
For some errors if the found token is not on the same line as the previous token, point to the end of the previous token. This usually results in more helpful errors.
2022-02-14stage2 AArch64: Fix issue in binOp and add regression testjoachimschmidt557
2022-02-14stage2 AArch64: implement cond_br for other MCValuesjoachimschmidt557
2022-02-13update compile error testsVeikka Tuominen
2022-02-08wasm: update test runnerLuuk de Gram
This updates the test runner for stage2 to emit to stdout with the passed, skipped and failed tests similar to the LLVM backend. Another change to this is the start function, as it's now more in line with stage1's. The stage2 test infrastructure for wasm/wasi has been updated to reflect this as well.
2022-02-07stage2: lower unnamed constants in Elf and MachOJakub Konka
* link: add a virtual function `lowerUnnamedConsts`, similar to `updateFunc` or `updateDecl` which needs to be implemented by the linker backend in order to be used with the `CodeGen` code * elf: implement `lowerUnnamedConsts` specialization where we lower unnamed constants to `.rodata` section. We keep track of the atoms encompassing the lowered unnamed consts in a global table indexed by parent `Decl`. When the `Decl` is updated or destroyed, we clear the unnamed consts referenced within the `Decl`. * macho: implement `lowerUnnamedConsts` specialization where we lower unnamed constants to `__TEXT,__const` section. We keep track of the atoms encompassing the lowered unnamed consts in a global table indexed by parent `Decl`. When the `Decl` is updated or destroyed, we clear the unnamed consts referenced within the `Decl`. * x64: change `MCValue.linker_sym_index` into two `MCValue`s: `.got_load` and `.direct_load`. The former signifies to the emitter that it should emit a GOT load relocation, while the latter that it should emit a direct load (`SIGNED`) relocation. * x64: lower `struct` instantiations
2022-02-02stage2: update stage2 tests with qualified import lib names for externsJakub Konka
From ```zig extern fn write(...); ``` to ```zig extern "c" fn write(...); ```
2022-01-24stage2: rework a lot of stuffAndrew Kelley
AstGen: * rename the known_has_bits flag to known_non_opv to make it better reflect what it actually means. * add a known_comptime_only flag. * make the flags take advantage of identifiers of primitives and the fact that zig has no shadowing. * correct the known_non_opv flag for function bodies. Sema: * Rename `hasCodeGenBits` to `hasRuntimeBits` to better reflect what it does. - This function got a bit more complicated in this commit because of the duality of function bodies: on one hand they have runtime bits, but on the other hand they require being comptime known. * WipAnonDecl now takes a LazySrcDecl parameter and performs the type resolutions that it needs during finish(). * Implement comptime `@ptrToInt`. Codegen: * Improved handling of lowering decl_ref; make it work for comptime-known ptr-to-int values. - This same change had to be made many different times; perhaps we should look into merging the implementations of `genTypedValue` across x86, arm, aarch64, and riscv.
2022-01-15stage2: implement signed compareJakub Konka
2022-01-15stage2: refactor handling of immediates in x86_64 backendJakub Konka
Fixes issues with incorrect operand sizes in a handful of cases and allows for usage of differently sized integers in Zig sources.
2022-01-10stage2: enable zig test on x86_64-macos (#10551)Jakub Konka
* stage2: put decls in different MachO sections Use `getDeclVAddrWithReloc` when targeting MachO backend rather than `getDeclVAddr` - this fn returns a zero vaddr and instead creates a relocation on the linker side which will get automatically updated whenever the target decl is moved in memory. This fn also records a rebase of the target pointer so that its value is correctly slid in presence of ASLR. This commit enables `zig test` on x86_64-macos. * stage2: fix output section selection for type,val pairs
2022-01-06stage2: temporarily disable offending stage2 test on macOSJakub Konka
Another caveat, `zig test` doesn't currently work on stage2.
2022-01-06stage2: fix airSliceElemValJakub Konka
Refactor codegen and fix a bug in Isel.
2022-01-04stage2: implement isErr/isNonErr and unwrap errorJakub Konka
2022-01-02stage2 ARM: implement wrap_errunion_err for empty payloadsjoachimschmidt557
2022-01-01Merge pull request #10480 from joachimschmidt557/stage2-armJakub Konka
stage2 ARM: zig test working
2022-01-01stage2: augment stage2 test to test optional payload loweringJakub Konka
2022-01-01stage2 ARM: implement airUnwrapErrErr + airCmp for error setsjoachimschmidt557
2022-01-01stage2 ARM: implement airCall for function pointersjoachimschmidt557
2021-12-31stage2: implement loading-storing via pointer (in register)Jakub Konka
* load address (pointer) to a stack variable in a register via `lea` instruction * store value on the stack via a pointer stored in a register via `mov [reg], imm` instruction * the lowerings naturally are handled automatically by Mir -> Isel layer * add initial (without safety) implementation of `.optional_payload` * add matching stage2 test cases
2021-12-30Merge pull request #10455 from joachimschmidt557/stage2-armAndrew Kelley
stage2 ARM: basic slice + basic struct support
2021-12-30stage2 x86_64: add regression test for #7187joachimschmidt557
2021-12-30stage2 ARM: implement struct_field_ptr and struct_field_valjoachimschmidt557
2021-12-29stage2: lower 1-byte and 2-byte values saved to stackJakub Konka
* fix handling of `ah`, `bh`, `ch`, and `dh` registers (which are actually used as aliases to `dil`, etc. registers). Currenly, we treat them as aliases only meaning when we encounter `ah` we make sure to set the REX.W to promote the instruction to 64bits and use `dil` register instead - otherwise we might have mismatch between registers used in different parts of the codegen. In the future, we can and should use `ah`, etc. as upper 8bit halves of 16bit registers `ax`, etc. * fix bug in `airCmp` where `.cmp` MIR instruction shouldn't force type `Bool` but let the type of the original type propagate downwards - we need this to make an informed choice of the target register size and hence choose the right encoding down the line. * implement lowering of 1-byte and 2-byte values to stack and add matching stage2 tests for x86_64 codegen