summary refs log tree commit diff
path: root/src/librustc_codegen_ssa/back
AgeCommit message (Collapse)AuthorLines
2019-07-02Auto merge of #61268 - michaelwoerister:stabilize-pgo, r=alexcrichtonbors-4/+4
Stabilize support for Profile-guided Optimization This PR makes profile-guided optimization available via the `-C profile-generate` / `-C profile-use` pair of commandline flags and adds end-user documentation for the feature to the [rustc book](https://doc.rust-lang.org/rustc/). The PR thus ticks the last two remaining checkboxes of the [stabilization tracking issue](https://github.com/rust-lang/rust/issues/59913). From the tracking issue: > Profile-guided optimization (PGO) is a common optimization technique for ahead-of-time compilers. It works by collecting data about a program's typical execution (e.g. probability of branches taken, typical runtime values of variables, etc) and then uses this information during program optimization for things like inlining decisions, machine code layout, or indirect call promotion. If you are curious about how this can be used, there is a rendered version of the documentation this PR adds available [here]( https://github.com/michaelwoerister/rust/blob/stabilize-pgo/src/doc/rustc/src/profile-guided-optimization.md). r? @alexcrichton cc @rust-lang/compiler
2019-06-27rustc: Retry SIGILL linker invocationsAlex Crichton-24/+47
We've seen quite a few issues with spurious illegal instructions getting executed on OSX on CI recently. For whatever reason `cc` itself is executing an illegal instruction and we're not really getting any other information about what's happening. Since we're already retrying the linker when it segfaults, let's just continue to retry everything and automatically reinvoke the linker when it fails with an illegal instruction.
2019-06-21Stabilize profile-guided optimization.Michael Woerister-4/+4
2019-06-20rename hir::map::get_by_hir_id to getljedrz-1/+1
2019-06-16Separate librustc_codegen_ssa modulechansuke-95/+94
2019-06-15Auto merge of #59752 - Zoxc:dylib-fix, r=alexcrichtonbors-15/+8
Limit dylib symbols This makes `windows-gnu` match the behavior of `windows-msvc`. It probably doesn't make sense to export these symbols on other platforms either.
2019-06-14Unify all uses of 'gcx and 'tcx.Eduard-Mihai Burtescu-19/+19
2019-06-12Add a limit_rdylib_exports option and disable it for SolarisJohn Kåre Alsaker-7/+4
2019-06-12Limit dylib symbolsJohn Kåre Alsaker-9/+5
2019-06-12Run `rustfmt --file-lines ...` for changes from previous commits.Eduard-Mihai Burtescu-29/+24
2019-06-12rustc: replace `TyCtxt<'tcx, 'gcx, 'tcx>` with `TyCtxt<'gcx, 'tcx>`.Eduard-Mihai Burtescu-19/+19
2019-06-12Fix fallout from `deny(unused_lifetimes)`.Eduard-Mihai Burtescu-6/+6
2019-06-12rustc: replace `TyCtxt<'a, 'gcx, 'tcx>` with `TyCtxt<'tcx, 'gcx, 'tcx>`.Eduard-Mihai Burtescu-6/+6
2019-06-05Aggregation of drive-by cosmetic changes.Alexander Regueiro-4/+4
2019-05-28Rename PgoGenerate to something more general.Michael Woerister-3/+3
2019-05-27Use a PathBuf instead of String for representing the pgo-use path internally.Michael Woerister-2/+2
2019-05-23Update dylib_dependency_formats, extern_crate and reachable_non_genericsJohn Kåre Alsaker-4/+3
2019-05-23Update upstream_monomorphizations and upstream_monomorphizations_forJohn Kåre Alsaker-8/+4
2019-05-21Make -Zemit-artifact-notifications also emit the artifact typeJeremy Fitzhardinge-1/+1
This is easier for tooling to handle than trying to reverse-engineer it from the filename extension.
2019-05-16add targetarch for CodegenContextChandler Deng-0/+2
2019-05-13Remove the equality operation between `Symbol` and strings.Nicholas Nethercote-1/+1
And also the equality between `Path` and strings, because `Path` is made up of `Symbol`s.
2019-05-13Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.Nicholas Nethercote-3/+3
2019-05-07Auto merge of #60464 - eddyb:not-overly-specific-pipelining, r=alexcrichtonbors-0/+3
rustc: rename -Z emit-directives to -Z emit-artifact-notifications and simplify the output. This is my take on #60006 / #60419 (see https://github.com/rust-lang/rust/pull/60006#discussion_r275983732). I'm not too attached the "notifications" part, it's pretty much bikeshed material. **EDIT**: for "artifact", @matklad pointed out Cargo already uses it (in https://github.com/rust-lang/rust/pull/60464#issuecomment-488576998) The first two commits are fixes that could be landed independently, especially the `compiletest` one, which removes the need for any of the normalization added in #60006 to land the test. The last commit enables the emission for all outputs, which was my main suggestion for #60006, mostly to show that it's minimal and not really a "scope creep" (as suggested in https://github.com/rust-lang/rust/pull/60006#discussion_r279964081). cc @alexcrichton @nnethercote
2019-05-07rustc_codegen_ssa: emit artifact notifications for the main link product too.Eduard-Mihai Burtescu-0/+3
2019-05-03rustc: Always handle exported symbols on the wasm targetAlex Crichton-6/+14
Currently when linking an artifact rustc will only conditionally call the `Linker::export_symbols` function, but this causes issues on some targets, like WebAssembly, where it means that executable outputs will not have the same symbols exported that cdylib outputs have. This commit sinks the conditional call to `export_symbols` inside the various implementations of the function that still need it, and otherwise the wasm linker is configured to always pass through symbol visibility lists.
2019-05-01Move metadata writing earlier.Nicholas Nethercote-29/+6
The commit moves metadata writing from `link_binary` to `encode_metadata` (and renames the latter as `encode_and_write_metadata`). This is at the very start of code generation.
2019-05-01Inline and remove `link_binary_output`.Nicholas Nethercote-74/+61
This change simplifies things for the subsequent commit.
2019-04-30In JSON output, emit a directive after metadata is generated.Nicholas Nethercote-4/+10
To implement pipelining, Cargo needs to know when metadata generation is finished. This commit adds code to do that. Unfortunately, metadata file writing currently occurs very late during compilation, so pipelining won't produce a speed-up. Moving metadata file writing earlier will be a follow-up. The change involves splitting the existing `Emitter::emit` method in two: `Emitter::emit_diagnostic` and `Emitter::emit_directive`. The JSON directives look like this: ``` {"directive":"metadata file written: liba.rmeta"} ``` The functionality is behind the `-Z emit-directives` option, and also requires `--error-format=json`.
2019-04-26Remove some unused return values.Nicholas Nethercote-25/+15
2019-04-24Don't generate unnecessary rmeta files.Nicholas Nethercote-13/+17
2019-04-20Tidybjorn3-2/+15
2019-04-20Move almost all of cg_llvm/back/link.rs to cg_ssabjorn3-5/+1559
2019-04-20Remove get_reloc_model and target_cpu dependency from most of link.rsbjorn3-1/+1
2019-04-20Make link functions generic over archive builderbjorn3-1/+16
2019-04-20Move some function from cg_llvm/back/link.rs to cg_ssa/back/link.rsbjorn3-2/+379
2019-04-14Rollup merge of #59874 - michaelwoerister:pgo-updates-1, r=cramertjMazdak Farrokhzad-4/+5
Clean up handling of `-Z pgo-gen` commandline option. This PR adapts the `-Z pgo-gen` flag to how Clang and GCC handle the corresponding `-fprofile-generate` flag. In particular, the flag now optionally takes a directory to place the profiling data in and allows to omit the argument (instead of having to pass an empty string).
2019-04-12Use measureme in self-profilerWesley Wiser-23/+14
Related to #58372 Related to #58967
2019-04-11Clean up handling of -Zpgo-gen commandline option.Michael Woerister-4/+5
2019-04-01Rollup merge of #58507 - Zoxc:time-extended, r=michaelwoeristerMazdak Farrokhzad-2/+2
Add a -Z time option which prints only passes which runs once This ensures `-Z time-passes` fits on my screen =P r? @michaelwoerister
2019-03-29Auto merge of #58605 - nagisa:fix-the-metadata, r=michaelwoeristerbors-1/+7
Use informational target machine for metadata Since there is nothing to optimise there... Should fix #58323 but haven’t tested locally. r? @michaelwoerister
2019-03-28Rollup merge of #59320 - alexcrichton:wasm-clang, r=sanxiynMazdak Farrokhzad-56/+21
rustc: Allow using `clang` for wasm32 targets This commit adds support code for using `clang` directly to link the wasm32-unknown-unknown target. Currently the target is only really configured to link with LLD directly, but this ensures that `clang` can be configured as well. While not immediately useful in the near term it's likely that more wasm32 targets will pop up over time with Clang's new native support for WebAssembly in the 8.0.0 release. Getting support into rustc early should make it easier to experiment with these targets and try out various changes here and there.
2019-03-28Rollup merge of #59318 - alexcrichton:check-for-clang, r=michaelwoeristerMazdak Farrokhzad-8/+11
rustc: Update linker flavor inference from filename This commit fixes what is believed to be a preexisting bug in the linker flavor inference and additionally adds a new features. Previously if the linker didn't end in `exe` the entire file name was compared to infer the linker's flavor. This commit fixes the code to instead unconditionally inspect `file_stem()` which is the relevant part we're looking at to figure out what the linker flavor is. Additionally this commit now also adds recognition of `clang` and clang wrappers that end in `-clang` (which look like gcc wrappers). This should allow clang-specific wrappers to get correctly inferred to the `Gcc` linker flavor rather than the default linker flavor configured for a target.
2019-03-27Use informational target machine for metadataSimonas Kazlauskas-1/+7
Since there is nothing to optimise there...
2019-03-26Remove the block on natvis for lld-link.TheGoddessInari-12/+0
2019-03-20rustc: Allow using `clang` for wasm32 targetsAlex Crichton-56/+21
This commit adds support code for using `clang` directly to link the wasm32-unknown-unknown target. Currently the target is only really configured to link with LLD directly, but this ensures that `clang` can be configured as well. While not immediately useful in the near term it's likely that more wasm32 targets will pop up over time with Clang's new native support for WebAssembly in the 8.0.0 release. Getting support into rustc early should make it easier to experiment with these targets and try out various changes here and there.
2019-03-20Add a -Z time option which prints only passes which runs onceJohn Kåre Alsaker-2/+2
2019-03-19rustc: Update linker flavor inference from filenameAlex Crichton-8/+11
This commit fixes what is believed to be a preexisting bug in the linker flavor inference and additionally adds a new features. Previously if the linker didn't end in `exe` the entire file name was compared to infer the linker's flavor. This commit fixes the code to instead unconditionally inspect `file_stem()` which is the relevant part we're looking at to figure out what the linker flavor is. Additionally this commit now also adds recognition of `clang` and clang wrappers that end in `-clang` (which look like gcc wrappers). This should allow clang-specific wrappers to get correctly inferred to the `Gcc` linker flavor rather than the default linker flavor configured for a target.
2019-03-14Use try blocks in rustc_codegen_ssaTaiki Endo-9/+6
2019-03-10Replace TimeLine with SelfProfilerWesley Wiser-52/+66
2019-03-08Rollup merge of #58984 - estebank:multi-treat-err-as-bug, r=oli-obkPietro Albini-1/+1
Teach `-Z treat-err-as-bug` to take a number of errors to emit `-Z treat-err-as-bug` will cause `rustc` to panic after the first error is reported, like previously. `-Z treat-err-as-bug=2` will cause `rustc` to panic after 2 errors have been reported. Fix #58983.