summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2021-11-23Feat: make cg_ssa get_param borrow the builder mutablerdambrosio-1/+1
2021-11-17Rollup merge of #90900 - andjo403:removeLlvm12Check, r=nikicMatthias Krüger-15/+0
Remove workaround for the forward progress handling in LLVM this workaround was only needed for LLVM < 12 and the minimum LLVM version was updated to 12 in #90175
2021-11-16Rollup merge of #90058 - joshtriplett:stabilize-strip, r=wesleywiserYuki Okushi-2/+12
Stabilize -Z strip as -C strip Leave -Z strip available temporarily as an alias, to avoid breaking cargo until cargo transitions to using -C strip.
2021-11-15Auto merge of #90717 - kit-981:fix-ld64-flags, r=petrochenkovbors-42/+50
Fix ld64 flags - The `-exported_symbols_list` argument appears to be malformed for `ld64` (if you are not going through `clang`). - The `-dynamiclib` argument isn't support for `ld64`. It should be guarded behind a compiler flag. These problems are fixed by these changes. I have also refactored the way linker arguments are generated to be ld/compiler agnostic and therefore less error prone. These changes are necessary to support cross-compilation to darwin targets.
2021-11-15Stabilize -Z strip as -C stripJosh Triplett-2/+12
Leave -Z strip available temporarily as an alias, to avoid breaking cargo until cargo transitions to using -C strip. (If the user passes both, the -C version wins.)
2021-11-14Remove workaround for the forward progress handling in LLVMAndreas Jonson-15/+0
2021-11-14Only use the -dynamiclib flag when the linker is not ldkit-1/+4
This is not a valid flag for ld64. When the ld64 linker is explicitly provided through `config.toml`, rustc will not successfully compile.
2021-11-14Refactor linker argument generationkit-30/+18
This commit refactors linker argument generation to leverage a helper function that abstracts away details governing how these arguments are transformed and provided to the linker. This fixes the misuse of the `-exported_symbols_list` when an ld-like linker is used rather than a compiler. A compiler would expect `-Wl,-exported_symbols_list,path` but ld would expect `-exported_symbols_list` and `path` as two seperate arguments. Prior to this change, an ld-like linker was given `-exported_symbols_list,path`.
2021-11-14Add a helper method for linker argumentskit-11/+28
Linker arguments must transformed when Rust is interacting with the linker through a compiler. This commit introduces a helper function that abstracts away details of this transformation.
2021-11-09Rollup merge of #90701 - michaelwoerister:more-artifact-sizes, r=davidtwcoMatthias Krüger-0/+13
Record more artifact sizes during self-profiling. This PR adds artifact size recording for - "linked artifacts" (executables, RLIBs, dylibs, static libs) - object files - dwo files - assembly files - crate metadata - LLVM bitcode files - LLVM IR files - codegen unit size estimates Currently the identifiers emitted for these are hard-coded as string literals. Is it worth adding constants to https://github.com/rust-lang/measureme/blob/master/measureme/src/rustc.rs instead? We don't do that for query names and the like -- but artifact kinds might be more stable than query names.
2021-11-09Rollup merge of #90688 - SparrowLii:dotprod, r=AmanieuYuki Okushi-0/+1
enable `dotprod` target feature in arm To implement `vdot` neon insturction in stdarch, we need to enable `dotprod` target feature in arm in rustc. r? `@Amanieu`
2021-11-09Auto merge of #87337 - jyn514:lint-error, r=oli-obk,flip1995bors-1/+1
Don't abort compilation after giving a lint error The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors. Closes https://github.com/rust-lang/rust/issues/82761. This is a WIP because I have a feeling it will exit with 0 even if there were lint errors; I don't have a computer that can build rustc locally at the moment.
2021-11-08Record more artifact sizes during self-profiling.Michael Woerister-0/+13
2021-11-08enable `dotprod` target feature in armSparrowLii-0/+1
2021-11-08Don't abort compilation after giving a lint errorJoshua Nelson-1/+1
The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors.
2021-11-07more clippy fixesMatthias Krüger-2/+2
2021-11-06Rollup merge of #90642 - matthiaskrgr:clippy_matches, r=cjgillotMatthias Krüger-4/+1
use matches!() macro in more places
2021-11-06use matches!() macro in more placesMatthias Krüger-4/+1
2021-11-06Auto merge of #90641 - matthiaskrgr:mut, r=cjgillotbors-1/+1
pointee_info_at() does not need mutable access
2021-11-06pointee_info_at() does not need mutable accessMatthias Krüger-1/+1
2021-11-05Initialize LLVM time trace profiler on each code generation threadTomasz Miąsko-51/+73
In https://reviews.llvm.org/D71059 LLVM 11, the time trace profiler was extended to support multiple threads. `timeTraceProfilerInitialize` creates a thread local profiler instance. When a thread finishes `timeTraceProfilerFinishThread` moves a thread local instance into a global collection of instances. Finally when all codegen work is complete `timeTraceProfilerWrite` writes data from the current thread local instance and the instances in global collection of instances. Previously, the profiler was intialized on a single thread only. Since this thread performs no code generation on its own, the resulting profile was empty. Update LLVM codegen to initialize & finish time trace profiler on each code generation thread.
2021-11-05Auto merge of #90577 - matthiaskrgr:clippy_perf_nov, r=petrochenkovbors-2/+2
clippy::perf fixes
2021-11-04clippy::perf fixesMatthias Krüger-2/+2
2021-11-03Update aarch64 `target_feature` list for LLVM 12.Adam Gemmell-8/+17
2021-10-28Revert "Add rustc lint, warning when iterating over hashmaps"Mark Rousskov-1/+0
2021-10-27Auto merge of #89652 - rcvalle:rust-cfi, r=nagisabors-3/+47
Add LLVM CFI support to the Rust compiler This PR adds LLVM Control Flow Integrity (CFI) support to the Rust compiler. It initially provides forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their number of arguments. Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by defining and using compatible type identifiers (see Type metadata in the design document in the tracking issue #89653). LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto). Thank you, `@eddyb` and `@pcc,` for all the help!
2021-10-27Auto merge of #89937 - JohnTitor:fix-89875, r=Amanieubors-1/+4
Properly check `target_features` not to trigger an assertion Fixes #89875 I think it should be a condition instead of an assertion to check if it's a register as it's possible that `reg` is a register class. Also, this isn't related to the issue directly, but `is_target_supported` doesn't check `target_features` attributes. Is there any way to check it on rustc_codegen_llvm? r? `@Amanieu`
2021-10-26Properly check `target_features` not to trigger an assertionYuki Okushi-1/+4
2021-10-26Auto merge of #85830 - bjorn3:separate_provide_extern, r=cjgillotbors-6/+6
Avoid a branch on key being local for queries that use the same local and extern providers Currently based on https://github.com/rust-lang/rust/pull/85810 as it slightly conflicts with it. Only the last two commits are new.
2021-10-25Add LLVM CFI support to the Rust compilerRamon de C Valle-3/+47
This commit adds LLVM Control Flow Integrity (CFI) support to the Rust compiler. It initially provides forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their number of arguments. Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by defining and using compatible type identifiers (see Type metadata in the design document in the tracking issue #89653). LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto).
2021-10-25Avoid a branch on key being local for queries that use the same local and ↵bjorn3-6/+6
extern providers
2021-10-25enable `i8mm` on armSparrowLii-0/+1
2021-10-25enable `i8mm` target feature on aarch64SparrowLii-1/+1
2021-10-24Rollup merge of #89558 - lcnr:query-stable-lint, r=estebankMatthias Krüger-0/+1
Add rustc lint, warning when iterating over hashmaps r? rust-lang/wg-incr-comp
2021-10-20Auto merge of #90050 - michaelwoerister:fix-vtable-debug-name-crash-90019, ↵bors-7/+4
r=wesleywiser Erase late-bound regions before computing vtable debuginfo name. Fixes #90019. The `msvc_enum_fallback()` for computing enum type names needs to access the memory layout of niche enums in order to determine the type name. `compute_debuginfo_vtable_name()` did not properly erase regions before computing type names which made memory layout computation ICE when encountering un-erased regions. r? `@wesleywiser`
2021-10-19Erase late-bound regions before computing vtable debuginfo name.Michael Woerister-7/+4
2021-10-16Adopt let_else across the compilerest31-6/+4
This performs a substitution of code following the pattern: let <id> = if let <pat> = ... { identity } else { ... : ! }; To simplify it to: let <pat> = ... { identity } else { ... : ! }; By adopting the let_else feature.
2021-10-15allow `potential_query_instability` everywherelcnr-0/+1
2021-10-11Auto merge of #89597 - michaelwoerister:improve-vtable-debuginfo, r=wesleywiserbors-3/+64
Create more accurate debuginfo for vtables. Before this PR all vtables would have the same name (`"vtable"`) in debuginfo. Now they get an unambiguous name that identifies the implementing type and the trait that is being implemented. This is only one of several possible improvements: - This PR describes vtables as arrays of `*const u8` pointers. It would nice to describe them as structs where function pointer is represented by a field with a name indicative of the method it maps to. However, this requires coming up with a naming scheme that avoids clashes between methods with the same name (which is possible if the vtable contains multiple traits). - The PR does not update the debuginfo we generate for the vtable-pointer field in a fat `dyn` pointer. Right now there does not seem to be an easy way of getting ahold of a vtable-layout without also knowing the concrete self-type of a trait object. r? `@wesleywiser`
2021-10-09Rollup merge of #89634 - hawkw:eliza/enable-err-warn, r=oli-obkMatthias Krüger-5/+4
rustc_driver: Enable the `WARN` log level by default This commit changes the `tracing_subscriber` initialization in `rustc_driver` so that the `WARN` verbosity level is enabled by default when the `RUSTC_LOG` env variable is empty. If the `RUSTC_LOG` env variable is set, the filter string in the environment variable is honored, instead. Fixes #76824 Closes #89623 cc ``@eddyb,`` ``@oli-obk``
2021-10-08Auto merge of #89619 - michaelwoerister:incr-vtables, r=nagisabors-1/+1
Turn vtable_allocation() into a query This PR removes the untracked vtable-const-allocation cache from the `tcx` and turns the `vtable_allocation()` method into a query. The change is pretty straightforward and should be backportable without too much effort. Fixes https://github.com/rust-lang/rust/issues/89598.
2021-10-08Create more accurate debuginfo for vtables.Michael Woerister-3/+64
Before this commit all vtables would have the same name "vtable" in debuginfo. Now they get a name that identifies the implementing type and the trait that is being implemented.
2021-10-07Rollup merge of #88137 - joshtriplett:osx-strip-symbols-no-option, ↵Jubilee-12/+10
r=michaelwoerister On macOS, make strip="symbols" not pass any options to strip This makes the output with `strip="symbols"` match the result of just calling `strip` on the output binary, minimizing the size of the binary.
2021-10-07lol i forgot the syntax for my own crate's macrosEliza Weisman-2/+2
T_____T Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2021-10-07comma-related changesEliza Weisman-1/+1
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2021-10-07Turn tcx.vtable_allocation() into a query.Michael Woerister-1/+1
2021-10-07use structured fields in some existing warningsEliza Weisman-5/+4
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2021-10-06Enable AutoFDO.Michael Benfield-0/+7
This largely involves implementing the options debug-info-for-profiling and profile-sample-use and forwarding them on to LLVM. AutoFDO can be used on x86-64 Linux like this: rustc -O -Cdebug-info-for-profiling main.rs -o main perf record -b ./main create_llvm_prof --binary=main --out=code.prof rustc -O -Cprofile-sample-use=code.prof main.rs -o main2 Now `main2` will have feedback directed optimization applied to it. The create_llvm_prof tool can be obtained from this github repository: https://github.com/google/autofdo Fixes #64892.
2021-10-03Remove re-export.Camille GILLOT-1/+2
2021-10-03Move rustc_middle::middle::cstore to rustc_session.Camille GILLOT-5/+5