mlugg
59447e5305
compiler: decide dbg_var scoping based on AIR blocks
...
This commit eliminates the `dbg_block_{begin,end}` instructions from
both ZIR and AIR. Instead, lexical scoping of `dbg_var_{ptr,val}`
instructions is decided based on the AIR block they exist within. This
is a much more robust system, and also results in a huge drop in ZIR
bytes - around 7% for Sema.zig.
This required some enhancements to Sema to prevent elision of blocks
when they are required for debug variable scoping. This can be observed
by looking at the AIR for the following simple test program with and
without `-fstrip`:
```zig
export fn f() void {
{
var a: u32 = 0;
_ = &a;
}
{
var a: u32 = 0;
_ = &a;
}
}
```
When `-fstrip` is passed, no AIR blocks are generated. When `-fno-strip`
is passed, the ZIR blocks are lowered to true AIR blocks to give correct
lexical scoping to the debug vars.
The changes here incidentally reolve #19060 . A corresponding behavior
test has been added.
Resolves : #19060
2024-02-26 13:20:45 +00: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
Andrew Kelley
9dda2eb1ab
Merge pull request #19080 from jacobly0/llvm-per-mod-strip
...
llvm: implement per-module stripping
2024-02-25 21:44:10 -08:00
Andrew Kelley
91fb211faa
Merge pull request #18906 from jacobly0/x86_64-tests
...
x86_64: pass more tests
2024-02-25 21:43:20 -08:00
Jacob Young
d656c2a7ab
test: rework how filtering works
...
* make test names contain the fully qualified name
* make test filters match the fully qualified name
* allow multiple test filters, where a test is skipped if it does not
match any of the specified filters
2024-02-25 19:12:08 -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
Jacob Young
e5c439a16d
x86_64: implement optional comparisons
...
Closes #18959
2024-02-25 11:22:10 +01:00
Jacob Young
2fcb2f5975
Sema: implement vector coercions
...
These used to be lowered elementwise in air, and now are a single air
instruction that can be lowered elementwise in the backend if necessary.
2024-02-25 11:22:10 +01: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
ceb2c030c4
llvm: revert debug file path resolution changes
...
Fixes test-stack-traces on windows.
2024-02-23 21:50:02 +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
1d4a7e123c
llvm: revert bad cleanup
2024-02-23 03:23:49 +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
antlilja
6cc51d3c33
LLVM: Set new debug location after inlining
2024-02-22 16:07:25 +01:00
antlilja
de536e8473
LLVM Builder: Emit metadata kinds and function metadata attachments
2024-02-22 15:29:28 +01:00
antlilja
92eec8dfec
LLVM Builder: Emit type for debug subprogram
2024-02-22 15:24:22 +01:00
Jacob Young
4b215e3a11
Builder: support printing metadata in llvm ir
2024-02-22 08:54:35 +01:00
antlilja
a907353ca4
LLVM Builder: Fix on 32-bit systems
2024-02-22 00:39:56 +01:00
antlilja
53f6071486
LLVM Builder: Emit debug vector types with DIVector flag
2024-02-21 23:33:25 +01:00
antlilja
5e9d0da43b
LLVM Builder: Correctly emit debug subranges
...
The bitcode abbrev was missing the subrange code
2024-02-21 23:32:21 +01:00
antlilja
e57f553c07
LLVM Builder: Rework MetadataString to not rely on String
...
This fixes a problem where empty strings where not emitted as null.
This should also emit a smaller stringtab as all metadata strings were
emitted in both the strtab and in the strings block inside the metadata
block.
2024-02-21 21:46:04 +01:00
Jacob Young
48bd0ed7f3
llvm: fix builds that don't link with libllvm
2024-02-21 19:18:34 +01:00
antlilja
713a555aa1
LLVM: Remove unused from llvm/bindings.zig and zig_llvm.h/.cpp
2024-02-21 17:54:00 +01:00
antlilja
f6d275b14e
LLVM: Remove use of LLVM in Builder
2024-02-21 17:53:15 +01:00
antlilja
626c3f7959
LLVM Builder: Emit debug info and metadata
2024-02-21 16:24:59 +01:00
antlilja
d35080b792
LLVM: Add Metadata/Debug bitcode IR
2024-02-21 16:24:59 +01:00
antlilja
c11c7a28a3
codegen/llvm: Remove use of DIBuilder and output bin by parsing bitcode
2024-02-21 16:24:59 +01:00