mlugg
407dc6eee4
Liveness: avoid emitting unused instructions or marking their operands as used
...
Backends want to avoid emitting unused instructions which do not have
side effects: to that end, they all have `Liveness.isUnused` checks for
many instructions. However, checking this in the backends avoids a lot
of potential optimizations. For instance, if a nested field is loaded,
then the first field access would still be emitted, since its result is
used by the next access (which is then unreferenced).
To elide more instructions, Liveness can track this data instead. For
operands which do not have to be lowered (i.e. are not side effecting
and are not something special like `arg), Liveness can ignore their
operand usages, and push the unused information further up, potentially
marking many more instructions as unreferenced.
In doing this, I also uncovered a bug in the LLVM backend relating to
discarding the result of `@cVaArg`, which this change fixes. A behaviour
test has been added to cover it.
2023-04-20 20:28:48 +01:00
mlugg
4486f27126
print_air: print new Liveness data
...
`try`, `try_ptr`, and `block` now have extra payloads.
2023-04-20 20:28:48 +01:00
Jacob Young
02a8b66b00
Liveness: add a liveness verification pass
...
This code only runs in a debug zig compiler, similar to verifying llvm modules.
2023-04-20 20:28:47 +01:00
Jacob Young
6f210b74ee
print_air: allow dumping air without liveness
...
This is useful for debug printing air when liveness is broken.
2023-04-20 20:28:04 +01:00
mlugg
8258530c39
Liveness: control flow analysis
...
This is a partial rewrite of Liveness, so has some other notable changes:
- A proper multi-pass system to prevent code duplication
- Better logging
- Minor bugfixes
2023-04-20 20:28:04 +01:00
mlugg
fac120bc3a
Module: mark function body dependencies, don't re-analyze anonymous decls
2023-04-20 09:09:15 -07:00
mlugg
d5f1a8823e
Sema: allow ptr field access on pointer-to-array
...
Also remove an incorrect piece of logic which allowed fetching the 'len'
property on non-single-ptrs (e.g. many-ptrs) and add a corresponding
compile error test case.
Resolves : #4765
2023-04-20 09:05:22 -07:00
Tw
31b6d14bf7
llvm: emit metadata for exported global variables ( #15349 )
...
* llvm: emit metadata for global variable
One use case is to genearte BTF information from global variable's metadata.
Signed-off-by: Tw <weii.tan>
2023-04-20 11:12:41 +00:00
kcbanner
a1aa55ebe5
compilation: fix generating coff debug info on -gnu
...
The issue with just passing `-gcodeview` is that it's not part of
the `OPT_g_Group` in `clang/Driver/Options.td`, so it doesn't trigger
debug info to be generated.
Passing only `-g` is sufficient on MSVC, as there is logic in `Clang.cpp`
which enables codeview if that is the default for the toolchain. Since
the default for -gnu is not codeview, we do pass `-gcodeview` in that case.
2023-04-18 21:29:20 -07:00
Andrew Kelley
0eebc25880
Merge pull request #15299 from truemedian/std-http
...
std.http: curated error sets and custom Headers
2023-04-18 19:56:24 -07:00
hequn
e1cc70ba11
Assembly file add soft float option for mips ( #15340 )
2023-04-18 21:41:16 -04:00
kcbanner
d2a799c65a
coff: support allow_shlib_undefined
2023-04-18 18:23:05 -07:00
Andrew Kelley
30fc160874
Merge pull request #15302 from jacobly0/x86_64-non-liveness
...
x86_64: liveness independent fixes
2023-04-18 17:28:19 -07:00
Nameless
a23c8662b4
std.http: pass Method to request directly, parse trailing headers
2023-04-18 10:28:53 -05:00
Jakub Konka
8ba937c787
Merge pull request #15339 from ziglang/link-and-x86_64-cleanups
...
Misc cleanups
2023-04-18 06:24:16 +02:00
Nameless
85221b4e97
std.http: curate some Server errors, fix reading chunked bodies
2023-04-17 19:16:01 -05:00
Nameless
134294230a
std.http: add Headers
2023-04-17 19:15:55 -05:00
kcbanner
40e1fca34b
compilation: fix non-zig compilations not using CacheMode.whole
...
main: consume --debug-log argument even when logging is disabled
2023-04-17 13:46:14 -07:00
Loris Cro
3d33a09069
autodoc: more support for linking decls in docs & guides
2023-04-17 20:13:08 +02:00
Jakub Konka
13503b7cba
x86_64: clean up formatting functions for Instruction and Operand
2023-04-17 13:43:01 +02:00
Jakub Konka
5bc4417d2a
tapi: fix memory bugs in yaml parser
2023-04-17 13:35:39 +02:00
Jacob Young
7e0c6d7edc
Sema: fix empty infinite loops
...
Closes #15284
2023-04-17 02:30:10 +03:00
Jacob Young
c1a2da6b78
x86_64: implement packed load and store
2023-04-16 17:05:35 -04:00
Jacob Young
c03771e173
x86_64: fix overflow of extended multiply
2023-04-16 17:05:34 -04:00
Jacob Young
08055f2942
x86_64: fix @clz direction
2023-04-16 17:05:34 -04:00
Jakub Konka
bc804eb841
Merge pull request #15291 from ziglang/x86_64-more-memory
...
x86_64: fix memory loads some more
2023-04-16 15:02:08 +02:00
Jakub Konka
ecc52d859f
x86_64: fix loading/storing pointers from linker deferred memory locations
2023-04-15 20:59:51 +02:00
serg
23ac4dd87b
fix: print targets
2023-04-15 19:44:56 +03:00
Loris Cro
aa765c1d70
autodoc: add support for defining guide sections
...
For example:
//!zig-autodoc-section: Advanced Topics
2023-04-15 18:26:53 +02:00
Jakub Konka
b82130709d
x86_64: cleanup different memory load types
...
Split `MCValue.linker_load` into `.load_got`, `.load_direct`, and
`.lea_direct`.
2023-04-15 11:10:24 +02:00
Jakub Konka
179117c114
x86_64: split MCValue.tlv_reloc into .load_tlv and .lea_tlv
...
`.load_tlv` signifies we want to load the value of a TLV
`.lea_tlv` signifies we want to load effective address of a TLV
2023-04-15 00:57:23 +02:00
Luuk de Gram
61c08d3c7e
fix zig cc linker flags for Wasm
...
Closes #15258
2023-04-14 15:18:18 -04:00
Jakub Konka
5e19250a12
Merge pull request #15185 from ziglang/macho-tls
...
macho: add TLS support
2023-04-13 22:54:55 +02:00
Luuk de Gram
25e3851fe0
Merge pull request #15257 from Luukdegram/wasm-tagname
...
wasm: Implement `@tagName` instruction
2023-04-13 19:32:22 +02:00
Krzysztof Wolicki
8bbf62c3b9
autodoc: Handling of explicit values for enum fields
...
Fixes to frontend handling of structs
2023-04-13 17:42:29 +02:00
Krzysztof Wolicki
97b3b36c65
autodoc: Handling of default values for struct fields
2023-04-13 17:42:29 +02:00
Loris Cro
5c9906c231
autodoc: make DeclStatus references long-lived
2023-04-13 17:38:24 +02:00
Jakub Konka
3f35d6984f
x86_64: make TLV a separate MCValue
2023-04-13 16:35:45 +02:00
Jakub Konka
887da399eb
x86_64: fix load() and store() to accommodate TLV
2023-04-13 11:47:51 +02:00
Jakub Konka
fd52d4537a
x86_64: emit pointer to TLV for macho
2023-04-13 11:47:51 +02:00
Jakub Konka
1f6165f621
macho: reference TLV thunks via GOT table
2023-04-13 11:47:51 +02:00
Jakub Konka
094ff60252
macho: emit TLV pointers and variables
2023-04-13 11:47:51 +02:00
Jakub Konka
09b6bd86de
macho: cleanup dirtying and writing GOT atoms
2023-04-13 11:47:51 +02:00
Jakub Konka
57f9304275
macho: improve reporting of missing symbols
...
Fix a typo in TLV bootstrap symbol: __tlv_bootstrap.
2023-04-13 11:47:51 +02:00
Jakub Konka
ef645ab175
macho: refactor common logic between synthetic tables
2023-04-13 11:47:51 +02:00
Jakub Konka
38ecaf3ab6
macho: add machinery for emitting TLV refs
2023-04-13 11:47:51 +02:00
Jakub Konka
eba280ce20
macho: refactor relocation type in incremental linker
2023-04-13 11:47:51 +02:00
Jakub Konka
1795b8eb4e
macho: emit TLS sections
2023-04-13 11:47:51 +02:00
Jakub Konka
cf9ba2965e
x86_64: remove loadMemPtrIntoRegister() now redundant
2023-04-13 11:47:51 +02:00
Jakub Konka
e07120d704
x86_64: simplify genInlineMemset() when setting value in memory
2023-04-13 11:47:51 +02:00