about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa/back
AgeCommit message (Collapse)AuthorLines
2019-07-25rustc: codegen: Build import library for all windows targetsHugo Beauzée-Luyssen-0/+20
So far it is assumed that using a DLL as a -l parameter argument is ok, but the assumption doesn't hold when compiling the native code with llvm. In which case, an import library is required, so let's build one This also requires the cargo counterpart to add the import library in the stamp files, at least when compiling libstd. Otherwise, the files don't get uplifted
2019-07-25std: Use native `#[thread_local]` TLS on wasmAlex Crichton-0/+7
This commit moves `thread_local!` on WebAssembly targets to using the `#[thread_local]` attribute in LLVM. This was recently implemented upstream and is [in the process of being documented][dox]. This change only takes affect if modules are compiled with `+atomics` which is currently unstable and a pretty esoteric method of compiling wasm artifacts. This "new power" of the wasm toolchain means that the old `wasm-bindgen-threads` feature of the standard library can be removed since it should now be possible to create a fully functioning threaded wasm module without intrusively dealing with libstd symbols or intrinsics. Yay! [dox]: https://github.com/WebAssembly/tool-conventions/pull/116
2019-07-25rustc: Update wasm32 support for LLVM 9Alex Crichton-201/+39
This commit brings in a number of minor updates for rustc's support for the wasm target which has changed in the LLVM 9 update. Notable updates include: * The compiler now no longer manually inserts the `producers` section, instead relying on LLVM to do so. LLVM uses the `llvm.ident` metadata for the `processed-by` directive (which is now emitted on the wasm target in this PR) and it uses debuginfo to figure out what `language` to put in the `producers` section. * Threaded WebAssembly code now requires different flags to be passed with LLD. In LLD we now pass: * `--shared-memory` - required since objects are compiled with atomics. This also means that the generated memory will be marked as `shared`. * `--max-memory=1GB` - required with the `--shared-memory` argument since shared memories in WebAssembly must have a maximum size. The 1GB number is intended to be a conservative estimate for rustc, but it should be overridable with `-C link-arg` if necessary. * `--passive-segments` - this has become the default for multithreaded memory, but when compiling a threaded module all data segments need to be marked as passive to ensure they don't re-initialize memory for each thread. This will also cause LLD to emit a synthetic function to initialize memory which users will have to arrange to call. * The `__heap_base` and `__data_end` globals are explicitly exported since they're now hidden by default due to the `--export` flags we pass to LLD.
2019-07-24Merge `rustc_allocator` into `libsyntax_ext`Vadim Petrochenkov-2/+2
2019-07-23cleanup: Remove `extern crate serialize as rustc_serialize`sVadim Petrochenkov-2/+2
2019-07-19libsyntax: Remove `Mark` into `ExpnId`Vadim Petrochenkov-2/+2
2019-07-05Rollup merge of #62168 - ljedrz:the_culmination_of_hiridification, r=ZoxcMazdak Farrokhzad-2/+2
The (almost) culmination of HirIdification It's finally over. This PR removes old `FIXME`s and renames some functions so that the `HirId` variant has the shorter name. All that remains (and rightfully so) is stuff in `resolve`, `save_analysis` and (as far as I can tell) in a few places where we can't replace `NodeId` with `HirId`.
2019-07-05Add a "total" measurement to -Ztime-passes.Nicholas Nethercote-1/+1
This is useful for getting the total compilation time at the end. To do this, the patch changes `print_time_passes_entry` to not increment the depth, which means that `print_time_passes_entry_internal` is no longer needed.
2019-07-04rename hir::map::local_def_id_from_hir_id to local_def_idljedrz-2/+2
2019-07-04Rollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, ↵Mazdak Farrokhzad-7/+4
r=dtolnay,Centril Use mem::take instead of mem::replace with default
2019-07-04Rollup merge of #62039 - jeremystucki:needless_lifetimes, r=eddybMazdak Farrokhzad-14/+14
Remove needless lifetimes (rustc)
2019-07-03Rollup merge of #62021 - crlf0710:msvc_link_output_improve, r=alexcrichtonMark Rousskov-4/+8
MSVC link output improve Resolves #35785. However i haven't come up with a idea to add test case for this :( r? @retep998
2019-07-03Remove needless lifetimesJeremy Stucki-14/+14
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-07-01Convert more usages overChris Gregory-7/+4
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-24Add mention of VS 2019 in link error output.CrLF0710-4/+8
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