summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/base.rs
AgeCommit message (Collapse)AuthorLines
2022-10-25Simplify `cast_shift_expr_rhs`.Nicholas Nethercote-21/+16
It's only ever used with shift operators.
2022-10-25Inline and remove `cast_shift_rhs`.Nicholas Nethercote-9/+0
It has a single call site.
2022-10-15linker: Fix weak lang item linking with combination windows-gnu + LLD + LTOVadim Petrochenkov-3/+8
2022-10-14Address nits, add test for implicit dyn-star coercion without feature gateMichael Goulet-2/+5
2022-10-14Allow dyn* upcastingMichael Goulet-13/+48
2022-10-01Merge apply_attrs_callsite into call and invokebjorn3-1/+1
Some codegen backends are not able to apply callsite attrs after the fact.
2022-09-10Fix pointer value punning.Charles Lew-1/+6
Seems this doesn't trigger error on LLVM 15, but let's fix it for better compatibility.
2022-09-06Fix CI failures on windows and aarch64-linuxVadim Petrochenkov-20/+28
2022-09-06change stdlib circular dependencies handlingDaniil Belov-17/+27
2022-08-28Support `#[unix_sigpipe = "inherit|sig_dfl|sig_ign"]` on `fn main()`Martin Nordholts-6/+10
This makes it possible to instruct libstd to never touch the signal handler for `SIGPIPE`, which makes programs pipeable by default (e.g. with `./your-program | head -n 1`) without `ErrorKind::BrokenPipe` errors.
2022-08-06make NOP dyn casts not require anything about the vtableRalf Jung-0/+1
2022-07-27Reliably signal coordinator thread on panic during ongoing codegenNikita Popov-54/+4
Replace the separate AbortCodegenOnDrop guard by integrating this functionality into OngoingCodegen (or rather, the Coordinator part of it). This ensures that we send a CodegenAborted message and wait for workers to finish even if the panic occurs outside codegen_crate() (e.g. inside join_codegen()). This requires some minor changes to the handling of CodegenAborted, as it can now occur when the main thread is LLVMing rather than Codegenning.
2022-07-20consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)Ralf Jung-1/+1
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-1/+1
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-06-07Rollup merge of #97738 - Kixiron:zst-panic, r=eddybDylan DPC-2/+3
Fix ICEs from zsts within unsized types with non-zero offsets - Fixes #97732 - Fixes ICEs while compiling `alloc` with `-Z randomize-layout` r? ``@eddyb``
2022-06-06Rename CodegenUnit::work_product to previous_work_productbjorn3-2/+2
It returns the previous work product or panics if there is none. This rename makes the purpose of this method clearer.
2022-06-04Fixed premature assertions that caused -Z randomize-layout to fail on allocChase Wilson-2/+3
2022-05-24Add support for embedding pretty printers via the `#[debugger_visualizer]` ↵ridwanabdillahi-13/+48
attribute. Add tests for embedding pretty printers and update documentation. Ensure all error checking for `#[debugger_visualizer]` is done up front and not when the `debugger_visualizer` query is run. Clean up potential ODR violations when embedding pretty printers into the `__rustc_debug_gdb_scripts_section__` section. Respond to PR comments and update documentation.
2022-05-15Compute pre_compiled_cgus more eagerlybjorn3-28/+19
This reduces the complexity of this code a lot
2022-05-15Move cgu_reuse a bit earlierbjorn3-8/+8
There is no reason it needs to be lazily computed at the first iteration of the cgu loop.
2022-05-03Add support for a new attribute `#[debugger_visualizer]` to support ↵ridwanabdillahi-1/+17
embedding debugger visualizers into a generated PDB. Cleanup `DebuggerVisualizerFile` type and other minor cleanup of queries. Merge the queries for debugger visualizers into a single query. Revert move of `resolve_path` to `rustc_builtin_macros`. Update dependencies in Cargo.toml for `rustc_passes`. Respond to PR comments. Load visualizer files into opaque bytes `Vec<u8>`. Debugger visualizers for dynamically linked crates should not be embedded in the current crate. Update the unstable book with the new feature. Add the tracking issue for the debugger_visualizer feature. Respond to PR comments and minor cleanups.
2022-04-30Merge new_metadata into codegen_allocatorbjorn3-9/+2
2022-04-25Auto merge of #95604 - nbdd0121:used2, r=petrochenkovbors-0/+7
Generate synthetic object file to ensure all exported and used symbols participate in the linking Fix #50007 and #47384 This is the synthetic object file approach that I described in https://github.com/rust-lang/rust/pull/95363#issuecomment-1079932354, allowing all exported and used symbols to be linked while still allowing them to be GCed. Related #93791, #95363 r? `@petrochenkov` cc `@carbotaniuman`
2022-04-18Synthesis object file for `#[used]` and exported symbolsGary Guo-0/+7
2022-04-08check_doc_keyword: don't alloc string for emptiness checkklensy-1/+1
check_doc_alias_value: get argument as Symbol to prevent needless string convertions check_doc_attrs: don't alloc vec, iterate over slice. Vec introduced in #83149, but no perf run posted on merge replace as_str() check with symbol check get_single_str_from_tts: don't prealloc string trivial string to str replace LifetimeScopeForPath::NonElided use Vec<Symbol> instead of Vec<String> AssertModuleSource use BTreeSet<Symbol> instead of BTreeSet<String> CrateInfo.crate_name replace FxHashMap<CrateNum, String> with FxHashMap<CrateNum, Symbol>
2022-03-28use cfg attribute instead of macroklensy-25/+27
2022-03-11Improve `AdtDef` interning.Nicholas Nethercote-1/+1
This commit makes `AdtDef` use `Interned`. Much the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`.
2022-02-23Normalize main return type during mono item collection & codegenTomasz Miąsko-1/+4
2022-02-19Adopt let else in more placesest31-12/+9
2022-02-09Ensure that queries only return Copy types.Camille GILLOT-2/+2
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-1/+1
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-1/+1
2021-12-15Remove `in_band_lifetimes` from `rustc_codegen_ssa`LegionMammal978-1/+1
See #91867 for more information.
2021-12-07Use object crate for .rustc metadata generationNikita Popov-26/+40
We already use the object crate for generating uncompressed .rmeta metadata object files. This switches the generation of compressed .rustc object files to use the object crate as well. These have slightly different requirements in that .rmeta should be completely excluded from any final compilation artifacts, while .rustc should be part of shared objects, but not loaded into memory. The primary motivation for this change is #90326: In LLVM 14, the current way of setting section flags (and in particular, preventing the setting of SHF_ALLOC) will no longer work. There are other ways we could work around this, but switching to the object crate seems like the most elegant, as we already use it for .rmeta, and as it makes this independent of the codegen backend. In particular, we don't need separate handling in codegen_llvm and codegen_gcc. codegen_cranelift should be able to reuse the implementation as well, though I have omitted that here, as it is not based on codegen_ssa. This change mostly extracts the existing code for .rmeta handling to allow using it for .rustc as well, and adjust the codegen infrastructure to handle the metadata object file separately: We no longer create a backend-specific module for it, and directly produce the compiled module instead. This does not fix #90326 by itself yet, as .llvmbc will need to be handled separately.
2021-09-30Move EncodedMetadata to rustc_metadata.Camille GILLOT-1/+1
2021-09-05Auto merge of #88499 - eddyb:layout-off, r=nagisabors-2/+2
Provide `layout_of` automatically (given tcx + param_env + error handling). After #88337, there's no longer any uses of `LayoutOf` within `rustc_target` itself, so I realized I could move the trait to `rustc_middle::ty::layout` and redesign it a bit. This is similar to #88338 (and supersedes it), but at no ergonomic loss, since there's no funky `C: LayoutOf<Ty = Ty>` -> `Ty: TyAbiInterface<C>` generic `impl` chain, and each `LayoutOf` still corresponds to one `impl` (of `LayoutOfHelpers`) for the specific context. After this PR, this is what's needed to get `trait LayoutOf` (with the `layout_of` method) implemented on some context type: * `TyCtxt`, via `HasTyCtxt` * `ParamEnv`, via `HasParamEnv` * a way to transform `LayoutError`s into the desired error type * an error type of `!` can be paired with having `cx.layout_of(...)` return `TyAndLayout` *without* `Result<...>` around it, such as used by codegen * this is done through a new `LayoutOfHelpers` trait (and so is specifying the type of `cx.layout_of(...)`) When going through this path (and not bypassing it with a manual `impl` of `LayoutOf`), the end result is that only the error case can be customized, the query itself and the success paths are guaranteed to be uniform. (**EDIT**: just noticed that because of the supertrait relationship, you cannot actually implement `LayoutOf` yourself, the blanket `impl` fully covers all possible context types that could ever implement it) Part of the motivation for this shape of API is that I've been working on querifying `FnAbi::of_*`, and what I want/need to introduce for that looks a lot like the setup in this PR - in particular, it's harder to express the `FnAbi` methods in `rustc_target`, since they're much more tied to `rustc` concepts. r? `@nagisa` cc `@oli-obk` `@bjorn3`
2021-09-02rustc_target: move `LayoutOf` to `ty::layout`.Eduard-Mihai Burtescu-2/+2
2021-08-31Include debug info for the allocator shimDaniel Paoliello-3/+9
Issue Details: In some cases it is necessary to generate an "allocator shim" to forward various Rust allocation functions (e.g., `__rust_alloc`) to an underlying function (e.g., `malloc`). However, since this allocator shim is a manually created LLVM module it is not processed via the normal module processing code and so no debug info is generated for it (if debugging info is enabled). Fix Details: * Modify the `debuginfo` code to allow creating debug info for a module without a `CodegenCx` (since it is difficult, and expensive, to create one just to emit some debug info). * After creating the allocator shim add in basic debug info.
2021-08-18Fold `vtable_trait_upcasting_coercion_new_vptr_slot` logic into obligation ↵Charles Lew-13/+2
processing.
2021-08-05Prepare call/invoke for opaque pointersJosh Stone-7/+8
Rather than relying on `getPointerElementType()` from LLVM function pointers, we now pass the function type explicitly when building `call` or `invoke` instructions.
2021-08-04Prepare inbounds_gep for opaque pointersTomasz Miąsko-2/+5
Implement inbounds_gep using LLVMBuildInBoundsGEP2 which takes an explicit type argument instead of deriving it from a pointer type.
2021-08-03Implement pointer casting.Charles Lew-41/+66
2021-07-07Auto merge of #86105 - bjorn3:link_info_refactor, r=petrochenkovbors-2/+18
Refactor the generation of the metadata for linking
2021-07-07Remove a sorting operation from used_cratesbjorn3-2/+18
2021-07-06Fold LinkerInfo into CrateInfobjorn3-3/+8
2021-07-06Remove unused panic_runtime field from CrateInfobjorn3-4/+0
2021-07-06Move LinkerInfo into CrateInfobjorn3-1/+4
2021-07-05Remove LibSourcebjorn3-4/+2
The information is stored in used_crate_source too anyway
2021-07-01Auto merge of #86749 - bjorn3:link_info_refactor_part1, r=petrochenkovbors-1/+1
Rename all_crate_nums query to crates and remove useless wrapper Split out of https://github.com/rust-lang/rust/pull/86105 r? `@petrochenkov`
2021-07-01Rename all_crate_nums query to crates and remove useless wrapperbjorn3-1/+1