about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm
AgeCommit message (Collapse)AuthorLines
2022-05-25rustc_codegen_ssa: cleanup `AtomicOrdering`Tomasz Miąsko-2/+1
* Remove unused `NotAtomic` ordering. * Rename `Monotonic` to `Relaxed` - a Rust specific name.
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-32/+31
2022-05-18Properly apply path prefix remapping paths emitted into debuginfo.Michael Woerister-69/+97
2022-05-16Add tmm_reg clobbersConnor Horman-3/+6
2022-05-13Add LLVM based mingw-w64 targetsMateusz Mikuła-2/+4
2022-05-12Auto merge of #95562 - lcnr:attr-no-encode, r=davidtwcobors-3/+2
don't encode only locally used attrs Part of https://github.com/rust-lang/compiler-team/issues/505. We now filter builtin attributes before encoding them in the crate metadata in case they should only be used in the local crate. To prevent accidental misuse `get_attrs` now requires the caller to state which attribute they are interested in. For places where that isn't trivially possible, I've added a method `fn get_attrs_unchecked` which I intend to remove in a followup PR. After this pull request landed, we can then slowly move all attributes to only be used in the local crate while being certain that we don't accidentally try to access them from extern crates. cc https://github.com/rust-lang/rust/pull/94963#issuecomment-1082924289
2022-05-12Auto merge of #96150 - est31:unused_macro_rules, r=petrochenkovbors-0/+2
Implement a lint to warn about unused macro rules This implements a new lint to warn about unused macro rules (arms/matchers), similar to the `unused_macros` lint added by #41907 that warns about entire macros. ```rust macro_rules! unused_empty { (hello) => { println!("Hello, world!") }; () => { println!("empty") }; //~ ERROR: 1st rule of macro `unused_empty` is never used } fn main() { unused_empty!(hello); } ``` Builds upon #96149 and #96156. Fixes #73576
2022-05-10only_local: always check for misuselcnr-3/+2
2022-05-07Auto merge of #96094 - Elliot-Roberts:fix_doctests, r=compiler-errorsbors-13/+13
Begin fixing all the broken doctests in `compiler/` Begins to fix #95994. All of them pass now but 24 of them I've marked with `ignore HELP (<explanation>)` (asking for help) as I'm unsure how to get them to work / if we should leave them as they are. There are also a few that I marked `ignore` that could maybe be made to work but seem less important. Each `ignore` has a rough "reason" for ignoring after it parentheses, with - `(pseudo-rust)` meaning "mostly rust-like but contains foreign syntax" - `(illustrative)` a somewhat catchall for either a fragment of rust that doesn't stand on its own (like a lone type), or abbreviated rust with ellipses and undeclared types that would get too cluttered if made compile-worthy. - `(not-rust)` stuff that isn't rust but benefits from the syntax highlighting, like MIR. - `(internal)` uses `rustc_*` code which would be difficult to make work with the testing setup. Those reason notes are a bit inconsistently applied and messy though. If that's important I can go through them again and try a more principled approach. When I run `rg '```ignore \(' .` on the repo, there look to be lots of different conventions other people have used for this sort of thing. I could try unifying them all if that would be helpful. I'm not sure if there was a better existing way to do this but I wrote my own script to help me run all the doctests and wade through the output. If that would be useful to anyone else, I put it here: https://github.com/Elliot-Roberts/rust_doctest_fixing_tool
2022-05-05Allow unused rules in some places in the compiler, library and toolsest31-0/+2
2022-05-04Stabilize `bool::then_some`Josh Triplett-1/+0
2022-05-03Rollup merge of #96587 - bjorn3:refactor_backend_write, r=michaelwoeristerYuki Okushi-27/+21
Refactor the WriteBackendMethods and ExtraBackendMethods traits The new interface is slightly less confusing and is easier to implement for non-LLVM backends.
2022-05-02fix most compiler/ doctestsElliot Roberts-13/+13
2022-05-02rustc: Panic by default in `DefIdTree::parent`Vadim Petrochenkov-1/+1
Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root. So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root. Same applies to `local_parent`/`opt_local_parent`.
2022-04-30Merge new_metadata into codegen_allocatorbjorn3-7/+6
2022-04-30Remove config parameter of optimize_fat and avoid interior mutability for modulebjorn3-11/+7
2022-04-30Let LtoModuleCodegen::optimize take self by valuebjorn3-3/+3
2022-04-30Rename run_lto_pass_manager to optimize_fat and remove thin parameterbjorn3-9/+8
2022-04-28Rollup merge of #96432 - SparrowLii:dbg_scope, r=davidtwcoDylan DPC-19/+14
not need `Option` for `dbg_scope` This PR fixes a few FIXME about not using `Option` in `dbg_scope` field of `DebugScope`, during `create_function_debug_context` func in codegen parts. Added a `BitSet<SourceScope>` parameter to `make_mir_scope` to indicate whether the `DebugScope` has been instantiated. cc ````@eddyb````
2022-04-26not need `Option` for `dbg_scope`SparrowLii-19/+14
2022-04-25Auto merge of #95604 - nbdd0121:used2, r=petrochenkovbors-3/+3
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-25Rollup merge of #96215 - nikic:legacy-pm-removal, r=nagisaMatthias Krüger-24/+29
Drop support for legacy PM with LLVM 15 LLVM 15 already removes some of the legacy PM APIs we're using. This patch forces use of NewPM with LLVM 15 (with `-Z new-llvm-pass-manager=no` throwing a warning) and stubs out various FFI methods with a report_fatal_error on LLVM 15. For LLVMPassManagerBuilderPopulateLTOPassManager() I went with adding our own wrapper, as the alternative would be to muck about with weak symbols, which seems to be non-trivial as far as cross-platform support is concerned (std has `weak!` for this purpose, but only as an internal utility.) Fixes #96072. Fixes #96362.
2022-04-24Ensure `#[used]` symbols are preserved in LTOGary Guo-1/+1
2022-04-22debuginfo: Emit ZST struct debuginfo for unit type when CPP-like debuginfo ↵Michael Woerister-9/+16
is enabled (instead of custom basic type).
2022-04-20Stub out more PassManagerBuilder functionsNikita Popov-22/+16
2022-04-20Stub out various legacy PM functions with LLVM 15Nikita Popov-2/+2
2022-04-20Drop support for -Znew-llvm-pass-manager=no with LLVM 15Nikita Popov-0/+11
2022-04-19Rollup merge of #95740 - Amanieu:kreg0, r=nagisaDylan DPC-3/+13
asm: Add a kreg0 register class on x86 which includes k0 Previously we only exposed a kreg register class which excludes the k0 register since it can't be used in many instructions. However k0 is a valid register and we need to have a way of marking it as clobbered for clobber_abi. Fixes #94977
2022-04-19asm: Add a kreg0 register class on x86 which includes k0Amanieu d'Antras-3/+13
Previously we only exposed a kreg register class which excludes the k0 register since it can't be used in many instructions. However k0 is a valid register and we need to have a way of marking it as clobbered for clobber_abi. Fixes #94977
2022-04-18Add `SymbolExportInfo`Gary Guo-3/+3
This is currently a wrapper to `SymbolExportLevel` but it allows later addition of extra information.
2022-04-16Auto merge of #96117 - Dylan-DPC:rollup-5traczf, r=Dylan-DPCbors-1/+0
Rollup of 7 pull requests Successful merges: - #95887 (resolve: Create dummy bindings for all unresolved imports) - #96023 (couple of clippy::perf fixes) - #96035 (Update GitHub Actions actions/checkout Version v2 -> v3) - #96038 (docs: add link from zip to unzip) - #96047 (:arrow_up: rust-analyzer) - #96059 (clarify doc(cfg) wording) - #96081 (Make some `usize`-typed masks definitions agnostic to the size of `usize`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-16Rollup merge of #96023 - matthiaskrgr:clippyper1304, r=lcnrDylan DPC-1/+0
couple of clippy::perf fixes
2022-04-16Auto merge of #95689 - lqd:self-profiler, r=wesleywiserbors-7/+9
Allow self-profiler to only record potentially costly arguments when argument recording is turned on As discussed [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Identifying.20proc-macro.20slowdowns/near/277304909) with `@wesleywiser,` I'd like to record proc-macro expansions in the self-profiler, with some detailed data (per-expansion spans for example, to follow #95473). At the same time, I'd also like to avoid doing expensive things when tracking a generic activity's arguments, if they were not specifically opted into the event filter mask, to allow the self-profiler to be used in hotter contexts. This PR tries to offer: - a way to ensure a closure to record arguments will only be called in that situation, so that potentially costly arguments can still be recorded when needed. With the additional requirement that, if possible, it would offer a way to record non-owned data without adding many `generic_activity_with_arg_{...}`-style methods. This lead to the `generic_activity_with_arg_recorder` single entry-point, and the closure parameter would offer the new methods, able to be executed in a context where costly argument could be created without disturbing the profiled piece of code. - some facilities/patterns allowing to record more rustc specific data in this situation, without making `rustc_data_structures` where the self-profiler is defined, depend on other rustc crates (causing circular dependencies): in particular, spans. They are quite tricky to turn into strings (if the default `Debug` impl output does not match the context one needs them for), and since I'd also like to avoid the allocation there when arg recording is turned off today, that has turned into another flexibility requirement for the API in this PR (separating the span-specific recording into an extension trait). **edit**: I've removed this from the PR so that it's easier to review, and opened https://github.com/rust-lang/rust/pull/95739. - allow for extensibility in the future: other ways to record arguments, or additional data attached to them could be added in the future (e.g. recording the argument's name as well as its data). Some areas where I'd love feedback: - the API and names: the `EventArgRecorder` and its method for example. As well as the verbosity that comes from the increased flexibility. - if I should convert the existing `generic_activity_with_arg{s}` to just forward to `generic_activity_with_arg_recorder` + `recorder.record_arg` (or remove them altogether ? Probably not): I've used the new API in the simple case I could find of allocating for an arg that may not be recorded, and the rest don't seem costly. - [x] whether this API should panic if no arguments were recorded by the user-provided closure (like this PR currently does: it seems like an error to use an API dedicated to record arguments but not call the methods to then do so) or if this should just record a generic activity without arguments ? - whether the `record_arg` function should be `#[inline(always)]`, like the `generic_activity_*` functions ? As mentioned, r? `@wesleywiser` following our recent discussion.
2022-04-16Auto merge of #96108 - Dylan-DPC:rollup-t5f2fc9, r=Dylan-DPCbors-0/+21
Rollup of 9 pull requests Successful merges: - #93969 (Only add codegen backend to dep info if -Zbinary-dep-depinfo is used) - #94605 (Add missing links in platform support docs) - #95372 (make unaligned_references lint deny-by-default) - #95859 (Improve diagnostics for unterminated nested block comment) - #95961 (implement SIMD gather/scatter via vector getelementptr) - #96004 (Consider lifetimes when comparing types for equality in MIR validator) - #96050 (Remove some now-dead code that was only relevant before deaggregation.) - #96070 ([test] Add test cases for untested functions for BTreeMap) - #96099 (MaybeUninit array cleanup) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-16Rollup merge of #95961 - RalfJung:gather-scatter, r=workingjubileeDylan DPC-0/+21
implement SIMD gather/scatter via vector getelementptr Fixes https://github.com/rust-lang/portable-simd/issues/271 However, I don't *really* know what I am doing here... Cc ``@workingjubilee`` ``@calebzulawski`` I didn't do anything for cranelift -- ``@bjorn3`` not sure if it's okay for that backend to temporarily break. I'm happy to cherry-pick a patch that adds cranelift support. :)
2022-04-15Add codegen for global_asm! sym operandsAmanieu d'Antras-11/+52
2022-04-13couple of clippy::perf fixesMatthias Krüger-1/+0
2022-04-13Auto merge of #95656 - cjgillot:no-id-hashing-mode, r=Aaron1011bors-6/+2
Remove NodeIdHashingMode. r? `@ghost`
2022-04-12Remove NodeIdHashingMode.Camille GILLOT-6/+2
2022-04-12add simd_arith_offset intrinsicsRalf Jung-0/+21
2022-04-09Switch to the 'normal' basic block for writing asm outputs if needed.Luqman Aden-0/+5
We may sometimes emit an `invoke` instead of a `call` for inline assembly during the MIR -> LLVM IR lowering. But we failed to update the IR builder's current basic block before writing the results to the outputs. This would result in invalid IR because the basic block would end in a `store` instruction, which isn't a valid terminator.
2022-04-07port `codegen_module` activity to arg recorder APIRémy Rakic-4/+5
2022-04-07remove allocation from a self-profiling call in the LLVM backendRémy Rakic-1/+3
2022-04-07simplify a self-profiling activity call in the LLVM backendRémy Rakic-2/+1
and so that it doesn't allocate unless event argument recording is turned on
2022-04-05Use WrappingRange::full instead of hand-rolling itOli Scherer-1/+1
2022-04-05Mark scalar layout unions so that backends that do not support partially ↵Oli Scherer-56/+64
initialized scalars can special case them.
2022-04-03Replace every `String` in Target(Options) with `Cow<'static, str>`Loïc BRANSTETT-9/+11
2022-04-02make memcmp return a value of c_int_width instead of i32David Morrison-2/+12
2022-03-30Rollup merge of #95461 - nyurik:spelling, r=lcnrDylan DPC-2/+2
Spellchecking some comments This PR attempts to clean up some minor spelling mistakes in comments
2022-03-30Spellchecking compiler codeYuri Astrakhan-1/+1
Address some spelling mistakes in strings, private function names, and function params.