65 Commits

Author SHA1 Message Date
antlilja
ec5a433fdf Fix FastMath packed struct
* Added missing legacy field (unused_algebra)
* Made struct correct size (u32 -> u8)
2024-02-21 16:24:59 +01:00
antlilja
7cb8813743 Added value_indices and valueIndex to Function
value_indices keeps track of the value index of
each instruction in the function (i.e skips
instruction which do not have a result)
2024-02-21 16:24:59 +01:00
antlilja
423c2c3a27 Made .block = false in WipFunction.hasResultWip 2024-02-21 16:24:59 +01:00
antlilja
c57b4e70b0 Builder: Add function_attributes_set 2024-02-21 16:24:59 +01:00
antlilja
52e8434022 Added opcode functions to Instruction/Constant.Tag 2024-02-21 16:24:59 +01:00
antlilja
ff76ba64d6 Added values to AtomicRmw.Operation enum fields 2024-02-21 16:24:59 +01:00
antlilja
6df8302be6 Fixed values in AtomicOrdering enum 2024-02-21 16:24:59 +01:00
antlilja
fd3b81f93b LLVM Builder: Add toLlvm helper to Alignment 2024-02-21 16:24:59 +01:00
antlilja
2801bf6400 LLVM Builder: Add strtab helper to String 2024-02-21 16:24:59 +01:00
antlilja
9ccd7158b9 LLVM Builder: Make Type.Simple reflect LLVM codes 2024-02-21 16:24:59 +01:00
antlilja
8feae5d2d5 LLVM: Assign correct values to enum/union tags 2024-02-21 16:24:59 +01:00
Jacob Young
38c2a25735 Builder: fix memory leaks 2024-02-06 22:31:13 -05:00
Jacob Young
eaa6218f09 x86_64: fix errors compiling the compiler
This fixes issues targetting both `x86_64-linux` and `x86_64-macos` with
the self-hosted backend.
2024-02-04 22:58:38 -05:00
Andrew Kelley
94d61ce964
Merge pull request #17651 from Vexu/error-limit
Make distinct error limit configurable (attempt #2)
2023-10-23 03:19:03 -04:00
Veikka Tuominen
9d9e22e716 remove uses of non-configurable err_int 2023-10-22 14:29:26 +03:00
Andrew Kelley
7bab406c79 InternPool: store alignment of anon decls
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-21 21:38:41 -04:00
Jacob Young
4d106076c3 link: initialize llvm before calling the llvm API 2023-10-19 16:51:11 -04:00
Jacob Young
fbbccc9d5f Builder: fix incorrect type for 32-bit systems 2023-10-19 08:06:44 -04:00
Jacob Young
cad594372e llvm: update address space definitions to LLVM 17 2023-09-19 09:37:32 -07:00
Jacob Young
05e01301b0 Builder: further constant select cleanup 2023-09-19 09:37:32 -07:00
Andrew Kelley
6a07b7024a LLVM: update backend to LLVM 17
* LLVMConstSelect is removed (see
   https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179)
 * a couple functions use uint64_t instead of int now which means we
   no longer need `@intCast`.

release/17.x branch, commit 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8
2023-09-19 09:37:31 -07:00
Jacob Young
4ac20f69ac Revert "llvm: fix bootstrap"
This reverts commit ea72fea1a4e2bc8309c211308f49f7f2c38507be.
2023-08-20 12:40:34 -07:00
Jacob Young
1c5c3f499a cmake: fix auto-detection of various host targets
Closes #16800
2023-08-13 11:26:10 -07:00
Jacob Young
c4848694d2 llvm: enable even without libllvm linked 2023-08-09 05:47:13 -04:00
Jacob Young
35cd56a369 llvm: fix alias issues 2023-08-08 21:32:50 -04:00
Jacob Young
2bdd180c6f llvm: finish converting globals 2023-08-08 21:32:50 -04:00
Jacob Young
2499d8fb73 Builder: fix enough bugs to pass the behavior tests
without using any information from the LLVM API
2023-08-08 21:32:50 -04:00
Jacob Young
a66cd54f94 llvm: cleanup even more unused LLVM API bindings 2023-08-08 21:32:50 -04:00
Jacob Young
a0cb03ed99 llvm: finish converting instructions 2023-08-08 21:32:50 -04:00
Jacob Young
49cc1bff08 llvm: finish converting intrinsics 2023-08-08 21:32:50 -04:00
Jacob Young
6577f52614 llvm: convert vector reduction intrinsics
Scratch that thing I said about one pass. :)
2023-08-08 21:32:50 -04:00
Jacob Young
e1efd4d3c2 Builder: simplify intrinsic table
This format removes back-references allowing it to be parsed in a single
pass.  It also reduces the number of kinds, simplifying the code.
2023-08-08 21:32:50 -04:00
Jacob Young
5b79f08ee8 llvm: finish converting attributes to use Builder and the C LLVM API 2023-08-08 21:32:50 -04:00
Jacob Young
b63d9745b5 llvm: convert intrinsics to using Builder 2023-08-08 21:32:50 -04:00
Jacob Young
3ebf8ce970 Builder: fix builtin pseudo-instruction dumping 2023-08-08 21:32:50 -04:00
Jacob Young
f938404a45 Builder: fix attribute spacing 2023-08-08 21:32:50 -04:00
Jacob Young
1c7798a3cd
Merge pull request #16705 from antlilja/builder-intrinsics
Implement more intrinsics in new LLVM IR builder API and remove uses of LLVM owns API
2023-08-05 23:05:02 -04:00
Robin Voetter
68f84964b3 llvm: add const addrspace cast 2023-08-05 17:11:57 -07:00
antlilja
86f61a9d26
Implement bitop intrinsics in new LLVM IR builder
* llvm.bitreverse
* llvm.bswap
* llvm.ctpop
* llvm.ctlz
* llvm.cttz
2023-08-06 01:46:57 +02:00
antlilja
63dcffdf9f
Implement fp intrinsics in new LLVM IR builder
Intrinsics implemented
* llvm.ceil
* llvm.cos
* llvm.exp
* llvm.exp2
* llvm.fabs
* llvm.floor
* llvm.log
* llvm.log10
* llvm.log2
* llvm.round
* llvm.sin
* llvm.trunc
* llvm.fma
2023-08-06 01:46:51 +02:00
Jacob Young
9e0a34f329 llvm: fix data layout calculation for experimental llvm targets
Closes #16616
2023-08-01 19:20:22 -07:00
Jacob Young
125b453c58 llvm: fix SysV C abi for structs smaller than two eightbytes
Closes #16038
Closes #16288
2023-07-28 19:27:08 -04:00
Andrew Kelley
6cee98eb30 frontend: forbid packed and extern tuples 2023-07-25 21:45:33 -07:00
Jacob G-W
3c08fe931a make @typeInfo not return private decls
fixes #10731
Thanks @nektro for previous work in #14878

This change creates a small breaking change:
It removes the `is_pub` field of a decl in `@typeInfo`
2023-07-25 16:19:08 -07:00
Jacob Young
3fc2e36de2 llvm: convert global assembly 2023-07-23 23:48:19 -04:00
Jacob Young
533111e849 llvm: convert inline assembly
Also, implement TODOs from a previous commit.
2023-07-23 23:48:19 -04:00
Jacob Young
aa44f8f0fd llvm: convert attributes and non-intrinsic calls 2023-07-23 23:48:18 -04:00
Andrew Kelley
a2d81c547c llvm: fix building for 32-bit targets 2023-07-21 16:37:50 -07:00
Jacob Young
4d31d4d875 llvm: cleanup LLVM IR dumping 2023-07-20 02:44:40 -04:00
Jacob Young
a1062c63ca llvm: add Builder trailing extra interface 2023-07-20 01:48:50 -04:00