Andrew Kelley
f303c3943f
Revert "Merge pull request #20380 from tau-dev/master"
...
This reverts commit 397be0c9cc8156d38d1487a4c80210007033cbd0, reversing
changes made to 18d412ab2fb7bda92f7bfbdf732849bbcd066c33.
Caused test failures in master branch.
2024-07-21 02:44:58 -07:00
Tau
94cf4d2d81
llvm: add pass-by-reference info to debug types
...
Without this data, debugger expressions try to pass structs by-value,
which mostly just crashes.
Also: mark enums as enum classes to prevent the enumerators from
shadowing other identifiers.
2024-07-19 17:51:38 +02:00
Tau
177b3359a1
llvm: Do not generate static member definitions
...
They were not helping LLDB and actively throwing off GDB.
Also: clean up some llvm.Builder and llvm.ir definitions that are no
longer necessary.
2024-07-19 17:51:38 +02:00
Tau
359bbdd574
llvm: encode variables as DW_TAG_imported_declaration
...
Now we get working global variable lookup in GDB! LLDB still re-mangles,
and it looks like we can't do much about that for now.
Also: translate non-owning type declarations into typedefs.
2024-07-19 17:51:37 +02:00
Tau
876258abe4
llvm: set precise scopes on namespace types and variables
...
This will allow accessing non-local declarations from debuggers, which,
AFAICT, was impossible before.
Getting scopes right already works for type declarations and functions,
but will need some fiddling for variables:
For those, I tried imitating what Clang does for static member
variables, but LLDB tries to re-mangle those and then fails at lookup,
while GDB outright crashes. Hopefully I can find some other dwarven
incantation to do the right thing.
2024-07-19 17:46:34 +02:00
Jacob Young
9f8e4ddf25
Builder: fix llvm ir syntax
2024-07-13 04:04:14 -04:00
antlilja
efb00c20ee
LLVM Builder: Pass correct argument to ensureUnusedMetadataCapacity
...
The trail_len was being multiplied by the size of the type before
2024-07-03 16:45:05 -04:00
Andrew Kelley
ac3faa6cb3
LLVM backend: loongarch64 support
2024-06-05 13:43:35 -04:00
Andrew Kelley
708894cf99
add a debug subcommand for printing LLVM integer type alignment
...
Useful when debugging why upgrading from LLVM 17 to 18 caused C ABI
regressions. Turns out LLVM 18 does the following insane thing:
```diff
-[nix-shell:~/dev/zig/build-llvm17]$ stage4/bin/zig llvm-ints i386-linux-musl
+[nix-shell:~/src/zig/build-llvm18]$ stage4/bin/zig llvm-ints i386-linux-musl
LLVMABIAlignmentOfType(i1) == 1
LLVMABIAlignmentOfType(i8) == 1
LLVMABIAlignmentOfType(i16) == 2
LLVMABIAlignmentOfType(i32) == 4
LLVMABIAlignmentOfType(i64) == 4
-LLVMABIAlignmentOfType(i128) == 4
-LLVMABIAlignmentOfType(i256) == 4
+LLVMABIAlignmentOfType(i128) == 16
+LLVMABIAlignmentOfType(i256) == 16
```
2024-05-08 19:37:29 -07:00
Andrew Kelley
78002dbe47
add detect-cpu subcommand for debugging CPU features
...
This brings back `detectNativeCpuWithLLVM` so that we can troubleshoot
during LLVM upgrades.
closes #19793
2024-05-08 19:37:29 -07:00
Andrew Kelley
243ae3a6cb
update for LLVM 18 new target data
...
New OSs:
* XROS
* Serenity
* Vulkan
Removed OSs:
* Ananas
* CloudABI
* Minix
* Contiki
New CPUs:
* spirv
The removed stuff is removed from LLVM but not Zig.
2024-05-08 19:37:28 -07:00
antlilja
c231d94960
LLVM: Remove deprecated or soon to be deprecated constant expressions
2024-04-25 22:58:47 -07:00
Jacob Young
4e85536604
Builder: fix encoding big integers in bitcode
...
Closes #19543
2024-04-06 12:53:09 -07:00
antlilja
637b1d606d
LLVM Builder: Emit binary op optional flags for exact and no wrap
2024-04-06 14:57:46 -04:00
antlilja
79b868d504
LLVM: Use fast math when requested
2024-03-17 16:26:28 +01:00
antlilja
b20cee586c
LLVM: Fix incorrect fast constant in FastMath packed struct
2024-03-17 16:25:59 +01:00
antlilja
37a4d9391f
LLVM: Fix reaching unreachable code when emitting fast call
2024-03-17 16:23:14 +01:00
Tristan Ross
6067d39522
std.builtin: make atomic order fields lowercase
2024-03-11 07:09:10 -07:00
antlilja
e2345f006f
LLVM: Add enableBrokenDebugInfoCheck and getBrokenDebugInfo
...
These functions allows the caller to find out wether the context
encounters broken debug info or not.
2024-03-02 20:53:06 +01:00
antlilja
147beec7da
LLVM Builder: Fix emission of enum debug enumerator info bitcode
2024-02-29 12:02:13 -08:00
antlilja
40f99862e1
Builder: Implement StrtabString and use it for Global names
2024-02-28 14:46:43 +01:00
antlilja
826c6c0ec6
LLVM: Implement more efficient blob writing
2024-02-28 14:46:43 +01:00
Andrew Kelley
031f23117d
Merge pull request #19083 from antlilja/llvm-blockinfo
...
LLVM reduce size of emitted bitcode
2024-02-26 04:03:40 -08:00
antlilja
73a16d440b
Builder: Reduce size of DebugLoc abbrev
2024-02-26 01:02:16 +01:00
antlilja
9754d6d0a0
Builder: Use BlockInfo block to reduce size of bitcode
2024-02-26 01:00:58 +01:00
Jacob Young
ed026b5dff
llvm: free llvm data before running llvm optimizations
...
This reduces the max memory usage.
2024-02-25 17:37:27 +01:00
Jacob Young
1e1598950a
llvm: implement per-module stripping
...
This avoids llvm module verification errors when the strip option
is different across modules.
2024-02-25 17:37:27 +01:00
Jacob Young
661137ac92
Merge pull request #19074 from antlilja/llvm-debug-loc
...
Rework LLVM debug locations to not emit them twice
2024-02-25 17:03:45 +01:00
Jacob Young
f6af773578
llvm: remork memory management in emit
2024-02-25 03:58:06 -08:00
antlilja
71d9f3a86b
Builder: Fix llvm ir debug location output
2024-02-25 03:16:52 +01:00
antlilja
928914e25a
Builder: Improve debug location system
...
Debug locations are no longer emitted twice every time
2024-02-25 03:16:52 +01:00
Jacob Young
edb6486b3b
BitcodeWriter: cleanup type widths
2024-02-24 17:00:36 +01:00
Jacob Young
7e9f321f53
Builder: fix bitcode widths
2024-02-24 16:41:37 +01:00
antlilja
9b39e824cd
Builder: Emit metadata attachment for globals
2024-02-24 02:28:00 +01:00
Jacob Young
a8708dbf3b
Builder: fix inconsequential llvm ir flag syntax
2024-02-23 21:12:57 +01:00
Jacob Young
2c67a1ecd2
llvm: optimize i32 constants
2024-02-23 19:40:07 +01:00
Jacob Young
f644263a6c
Builder: fix llvm ir/bc difference with allocas
2024-02-23 18:17:14 +01:00
Jacob Young
03eb332d3c
Builder: fix aliases in bitcode
2024-02-23 18:17:14 +01:00
Jacob Young
7f3ade6dea
Builder: fix x86_fp80 constants in bitcode
2024-02-23 09:15:58 +01:00
Jacob Young
800495afab
Builder: fix minor llvm ir syntax errors
2024-02-23 07:51:38 +01:00
Jacob Young
6abb432598
Builder: implement opaque structs in bitcode
2024-02-23 07:51:38 +01:00
Jacob Young
43daed64fe
Builder: change tuple metadata to not be inlined in llvm ir
2024-02-23 06:18:10 +01:00
Jacob Young
be4ad235a7
Builder: fix inconsequential llvm ir metadata syntax
2024-02-23 03:23:49 +01:00
Jacob Young
8d0f6605fe
Builder: sync distinct bits with previous implementation
2024-02-23 03:23:49 +01:00
antlilja
dfde194287
LLVM Builder: Make some Metadata no longer be distinct
2024-02-23 03:12:54 +01:00
antlilja
0ba2185a42
LLVM Builder: Formatting
2024-02-23 03:12:35 +01:00
Jacob Young
c894df54f7
Builder: fix debug location of the first instruction in a block
2024-02-23 01:45:25 +01:00
Jacob Young
dbfa3238fe
Builder: fix float constants in llvm ir
2024-02-22 23:51:53 +01:00
Jacob Young
83e66d301e
Builder: fix bitcode strtab
2024-02-22 19:50:41 +01:00
Jacob Young
69a6f31596
Builder: fix llvm ir value names
...
Hello world now verifies when not stripped.
2024-02-22 19:10:52 +01:00