15409 Commits

Author SHA1 Message Date
Andrew Kelley
468ed7ada5
Merge pull request #9875 from g-w1/timestimes
stage2: emit Value.repeated for `**` with array len 1
2021-10-02 16:05:12 -04:00
Martin Wickham
05d36fce9c Add zlib to needed libraries 2021-10-02 14:58:16 -05:00
Andrew Kelley
49f687f7c6 build.zig: omit LLVMTableGen from the llvm lib list 2021-10-02 12:41:08 -07:00
Andrew Kelley
b9ec7c5675 build.zig: update list of LLVM libs
companion commit to 0f35a1f37ade9cf25707c41711b352174f1e2789

fixes compiling with a dev kit.
2021-10-02 12:40:40 -07:00
Andrew Kelley
dde0adcb36 Merge branch 'llvm13' 2021-10-02 10:45:56 -07:00
Andrew Kelley
7a2624c3e4 std: disable ArrayBitSet test on aarch64
See #9879. This regressed with the release of LLVM 13.0.0.
2021-10-01 22:32:13 -07:00
Andrew Kelley
c7b32eb99a ci: windows: update tar command line parameter order
you have got to be kidding me
2021-10-01 22:27:16 -07:00
Andrew Kelley
86bb09a0ff ci: update macos tarballs
These bring in a bug fix to libcxx.zig that is currently causing the CI
to fail.
2021-10-01 18:32:19 -07:00
Andrew Kelley
210ef5af8e ci: windows: adjust tar workaround
tar does not properly implement the -k feature, so don't use it.
It incorrectly reports "file exists" when the expected behavior is to
leave the existing file alone.
2021-10-01 18:07:50 -07:00
Andrew Kelley
f317acb2cd libcxx: pass -faligned-allocation flag when needed
libc++ now requires this flag
2021-10-01 18:06:17 -07:00
Andrew Kelley
acb0a87158 ci: windows: workaround for tar symlink behavior 2021-10-01 17:18:32 -07:00
Andrew Kelley
43e3734d3b ci: macos arm64 script uses release build of zig
even for the host. This prevents a dependency on "dump" functions of
LLVM, which are not included in the tarballs used for the CI.
2021-10-01 16:53:42 -07:00
Andrew Kelley
9bf10b1018 ci: update windows tarballs to llvm 13 2021-10-01 16:53:33 -07:00
Andrew Kelley
7350cb2fc7 ci: update tarballs for LLVM 13
NetBSD CI is disabled because it is not yet supported in
zig-bootstrap. Once NetBSD has proper zig-bootstrap support, it can be
re-enabled.

Windows is not solved here yet; will be pushing a separate commit for
that.
2021-10-01 16:07:42 -07:00
Jacob G-W
83dcd9f038 stage2: emit Value.repeated for ** where the array size is one
This takes advantage of the repeated value.
2021-10-01 16:46:28 -04:00
Andrew Kelley
456d7e5f5f libcxx: update to compile with -std=c++20
This is required to successfully build libc++.
2021-10-01 11:40:06 -07:00
Andrew Kelley
1bbec59e07 clang API bindings: fix enum detection functions
These functions are intended to emit compile errors when Clang adds new
items to its enums. However, two of them were casting to the Zig enum
and switching on that, which wouldn't detect anything useful.
2021-10-01 11:39:12 -07:00
Andrew Kelley
0f35a1f37a fix the list of llvm libraries
not sure what "HelloNew" was doing in there
2021-09-30 23:33:03 -07:00
Andrew Kelley
3eb729b442 Merge remote-tracking branch 'origin/master' into llvm13 2021-09-30 21:38:04 -07:00
Nathan Michaels
c4cd592f0e Fix a typo in @ceil documentation. 2021-09-30 23:32:09 -04:00
Jacob G-W
b0e89ee499 stage2 llvm backend: implement codegen for Value.repeated 2021-09-30 21:29:52 -04:00
g-w1
5e7406bdd9
stage2: implement array_init instruction (#9843)
* stage2: array mul support more types of operands
* stage2: array cat support more types of operands
* print_zir: print array_init
* stage2: implement Sema for array_init
2021-09-30 18:31:27 -04:00
Martin Wickham
c82c3585c8 Add error message to test runner for bad arguments 2021-09-30 18:00:13 -04:00
Martin Wickham
f87156e33c Add a panic handler to give better errors for crashes in sema 2021-09-30 17:39:01 -04:00
Matthew Borkowski
2ed9288246 parse.zig: better c pointer prefix parsing, don't index out of bounds on eof 2021-09-30 15:36:57 +02:00
Andrew Kelley
ba7f40c430 stage2: fix ELF linking to include compiler_rt
There was duplicated logic for whether to include compiler_rt in the
linker line both in the frontend and in the linker backends. Now the
logic is only in the frontend; the linker puts it on the linker line if
the frontend provides it.

Fixes the CI failures.
2021-09-29 15:37:34 -07:00
Andrew Kelley
bdbedff910 stage2: LLVM backend: properly set module target data
Also fix tripping LLVM assert having to do with 0 bit integers.
stage2 behavior tests now run clean in a debug build of llvm 12.
2021-09-29 15:33:45 -07:00
Andrew Kelley
ea6706b6f4 stage2: LLVM backend: implement struct type fwd decls
Makes struct types able to refer to themselves.
2021-09-29 14:04:52 -07:00
Andrew Kelley
1d1f6a0421 move some behavior tests to the "passing for stage2" section 2021-09-29 11:33:22 -07:00
Andrew Kelley
b02932f96e Sema: generic function instantiations gain addrspace of owner Decl 2021-09-29 11:09:37 -07:00
Andrew Kelley
4e85bf1185 stage2: put use_llvm and use_stage1 into the Module cache hash
This prevents a compiler_rt built with stage2 (which is intentionally
different than when built with stage1) from being used for stage1 and
vice versa.

Fixes the regression from the previous commit.
2021-09-29 10:46:32 -07:00
Andrew Kelley
99961f22dc stage2: enable building compiler_rt when using LLVM backend
* AstGen: fix emitting `store_to_inferred_ptr` when it should be emitting
   `store` for a variable that has an explicit alignment.
 * Compilation: fix a couple memory leaks
 * Sema: implement support for locals that have specified alignment.
 * Sema: implement `@intCast` when it needs to emit an AIR instruction.
 * Sema: implement `@alignOf`
 * Implement debug printing for extended alloc ZIR instructions.
2021-09-29 00:13:21 -07:00
Andrew Kelley
33e77f127d stage2: implement @clz and @ctz
Also improve the LLVM backend to support lowering bigints to LLVM
values.

Moves over a bunch of math.zig test cases to the "passing for stage2"
section.
2021-09-28 22:38:51 -07:00
Andrew Kelley
7efc2a0626 AstGen: improved logic for nodeMayNeedMemoryLocation
* `@as` and `@bitCast` no longer unconditionally return `true` from
   this function; they forward the question to their sub-expression.
 * fix `@splat` incorrectly being marked as needing a memory location
   (this function returns a SIMD vector; it definitely does not want a
   memory location).

Makes AstGen generate slightly nicer ZIR, which in turn generates
slightly nicer AIR, generating slightly nicer machine code in debug
builds.

It also means I can procrastinate implementing the bitcast_result_ptr
ZIR instruction semantic analysis :^)
2021-09-28 20:33:50 -07:00
Andrew Kelley
51a40f9a66 saturating arithmetic supports integers only 2021-09-28 20:27:28 -07:00
Andrew Kelley
cf90cb7218
Merge pull request #9679 from travisstaloch/sat-arith-operators
sat-arithmetic: add operator support
2021-09-28 22:21:15 -04:00
Andrew Kelley
5467582444 saturating arithmetic modifications
* Remove the builtins `@addWithSaturation`, `@subWithSaturation`,
   `@mulWithSaturation`, and `@shlWithSaturation` now that we have
   first-class syntax for saturating arithmetic.
 * langref: Clarify the behavior of `@shlExact`.
 * Ast: rename `bit_shift_left` to `shl` and `bit_shift_right` to `shr`
   for consistency.
 * Air: rename to include underscore separator with consistency with
   the rest of the ops.
 * Air: add shl_exact instruction
 * Use non-extended tags for saturating arithmetic, to keep it
   simple so that all the arithmetic operations can be done the same
   way.
   - Sema: unify analyzeArithmetic with analyzeSatArithmetic
     - implement comptime `+|`, `-|`, and `*|`
     - allow float operands to saturating arithmetic
 * `<<|` allows any integer type for the RHS.
 * C backend: fix rebase conflicts
 * LLVM backend: reduce the amount of branching for arithmetic ops
 * zig.h: fix magic number not matching actual size of C integer types
2021-09-28 19:19:28 -07:00
Andrew Kelley
71da169c67 AstGen: delete dead code 2021-09-28 17:04:19 -07:00
Andrew Kelley
6cb7906394 add missing zig fmt test for saturating arithmetic 2021-09-28 17:04:19 -07:00
Travis Staloch
51673bcb31 get build passing again after rebase 2021-09-28 17:04:19 -07:00
Travis Staloch
38703dc9c2 sat-arithmetic: don't test builtins in behavior tests
- not necessary as we are testing the operators
2021-09-28 17:04:19 -07:00
Travis Staloch
baaec94fe4 sat-arithmetic: create Sema.analyzeSatArithmetic
- similar to Sema.analyzeArithmetic but uses accepts Zir.Inst.Extended.InstData
- missing support for Pointer types and comptime arithmetic
2021-09-28 17:04:18 -07:00
Travis Staloch
cd8d8add91 sat-arithmetic: fix shl methods in cbe 2021-09-28 17:03:43 -07:00
Travis Staloch
68050852fa sat-arithmetic: minor formatting changes 2021-09-28 17:03:43 -07:00
Travis Staloch
fd8383545a sat-arithmetic: langref - use <th> tags 2021-09-28 17:03:43 -07:00
Travis Staloch
4870595352 sat-arithmetic: add additional tokenizer tests 2021-09-28 17:03:43 -07:00
Travis Staloch
1d86eae526 sat-arithmetic: langref - remove syntax disclaimer 2021-09-28 17:03:43 -07:00
Travis Staloch
0f246257be sat-arithmetic: update langref 2021-09-28 17:03:43 -07:00
Travis Staloch
6ba9f7474f sat-arithmetic: fix docgen 2021-09-28 17:03:43 -07:00
Travis Staloch
bdb90a07bb sat-arithmetic: fixups zig fmt / astcheck 2021-09-28 17:03:43 -07:00