about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/back
AgeCommit message (Collapse)AuthorLines
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-5/+3
2019-05-16add targetarch for CodegenContextChandler Deng-2/+2
2019-04-20Remove cg_llvm/back/link.rsbjorn3-25/+0
2019-04-20Move almost all of cg_llvm/back/link.rs to cg_ssabjorn3-1563/+15
2019-04-20Remove get_reloc_model and target_cpu dependency from most of link.rsbjorn3-14/+18
2019-04-20Make link functions generic over archive builderbjorn3-83/+85
2019-04-20Move some filename constants to cg_ssabjorn3-10/+6
2019-04-20Move some function from cg_llvm/back/link.rs to cg_ssa/back/link.rsbjorn3-373/+3
2019-04-14Rollup merge of #59874 - michaelwoerister:pgo-updates-1, r=cramertjMazdak Farrokhzad-7/+17
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-14Rollup merge of #59812 - michaelwoerister:profile-gen-msvc-imp, r=alexcrichtonMazdak Farrokhzad-1/+17
Exclude profiler-generated symbols from MSVC __imp_-symbol workaround. LLVM's profiling instrumentation adds a few symbols that are used by the profiler runtime. Since these show up as globals in the LLVM IR, the compiler generates `dllimport`-related `__imp_` stubs for them. This can lead to linker errors because the instrumentation symbols have weak linkage or are in a comdat section, but the `__imp_` stubs aren't. Instead of trying to replicate the linkage/comdat setup for the stubs, this PR just excludes the profiler-related symbols from stub-generation since they aren't supposed to be referenced via `__declspec(dllimport)` anywhere anyway. r? @alexcrichton EDIT: I considered making this more general, i.e. inferring from the symbol name if it is a Rust symbol or not. But then I figured out that that would yield false negatives for `#[no_mangle]` et al, so I went with a blacklist approach.
2019-04-12Use measureme in self-profilerWesley Wiser-20/+14
Related to #58372 Related to #58967
2019-04-11Clean up handling of -Zpgo-gen commandline option.Michael Woerister-7/+17
2019-04-09Exclude profiler-generated symbols from MSVC __imp_-symbol workaround.Michael Woerister-1/+17
2019-04-06Auto merge of #59744 - cuviper:output-errors, r=sanxiynbors-10/+15
Show better errors for LLVM IR output I was trying to output LLVM IR directly to the console: $ rustc hello.rs --emit=llvm-ir -o /dev/stdout LLVM ERROR: IO failure on output stream: Bad file descriptor Now `LLVMRustPrintModule` returns an error, and we print: error: failed to write LLVM IR to /dev/stdout.hello.7rcbfp3g-cgu.0.rcgu.ll: Permission denied ... which is more informative.
2019-04-05Show better errors for LLVM IR outputJosh Stone-10/+15
I was trying to output LLVM IR directly to the console: $ rustc hello.rs --emit=llvm-ir -o /dev/stdout LLVM ERROR: IO failure on output stream: Bad file descriptor Now `LLVMRustPrintModule` returns an error, and we print: error: failed to write LLVM IR to /dev/stdout.hello.7rcbfp3g-cgu.0.rcgu.ll: Permission denied ... which is more informative.
2019-04-04Remove invalid assertion back::link::from add_upstream_rust_crates().Michael Woerister-4/+0
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-27Use informational target machine for metadataSimonas Kazlauskas-9/+10
Since there is nothing to optimise there...
2019-03-20Add a -Z time option which prints only passes which runs onceJohn Kåre Alsaker-2/+2
2019-03-10Replace TimeLine with SelfProfilerWesley Wiser-57/+45
2019-02-26rustc: Update LLVM, remove dead wasm codeAlex Crichton-127/+0
This commit updates the LLVM branch to the rebased version of the upstream release/8.x branch. This includes a wasm patch which means that the `rewrite_imports` pass in rustc is no longer needed (yay!) and we can instead rely on `wasm-import-module`, an attribute we're already emitting, to take care of all the work.
2019-02-25librustc_codegen_llvm: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-11/+11
2019-02-18librustc_codegen_llvm => 2018Taiki Endo-35/+32
2019-02-14Rollup merge of #58378 - alexcrichton:incremental-lto, r=michaelwoeristerMazdak Farrokhzad-38/+101
rustc: Implement incremental "fat" LTO Currently the compiler will produce an error if both incremental compilation and full fat LTO is requested. With recent changes and the advent of incremental ThinLTO, however, all the hard work is already done for us and it's actually not too bad to remove this error! This commit updates the codegen backend to allow incremental full fat LTO. The semantics are that the input modules to LTO are all produce incrementally, but the final LTO step is always done unconditionally regardless of whether the inputs changed or not. The only real incremental win we could have here is if zero of the input modules changed, but that's so rare it's unlikely to be worthwhile to implement such a code path. cc #57968 cc rust-lang/cargo#6643
2019-02-13Rollup merge of #58057 - michaelwoerister:stabilize-xlto, r=alexcrichtonMazdak Farrokhzad-4/+4
Stabilize linker-plugin based LTO (aka cross-language LTO) This PR stabilizes [linker plugin based LTO](https://github.com/rust-lang/rust/issues/49879), also known as "cross-language LTO" because it allows for doing inlining and other optimizations across language boundaries in mixed Rust/C/C++ projects. As described in the tracking issue, it works by making `rustc` emit LLVM bitcode instead of machine code, the same as `clang` does. A linker with the proper plugin (like LLD) can then run (Thin)LTO across all modules. The feature has been implemented over a number of pull requests and there are various [codegen](https://github.com/rust-lang/rust/blob/master/src/test/codegen/no-dllimport-w-cross-lang-lto.rs) and [run](https://github.com/rust-lang/rust/tree/master/src/test/run-make-fulldeps/cross-lang-lto-clang)-[make](https://github.com/rust-lang/rust/tree/master/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs) [tests](https://github.com/rust-lang/rust/tree/master/src/test/run-make-fulldeps/cross-lang-lto) that make sure that it keeps working. It also works for building big projects like [Firefox](https://treeherder.mozilla.org/#/jobs?repo=try&revision=2ce2d5ddcea6fbff790503eac406954e469b2f5d). The PR makes the feature available under the `-C linker-plugin-lto` flag. As discussed in the tracking issue it is not cross-language specific and also not LLD specific. `-C linker-plugin-lto` is descriptive of what it does. If someone has a better name, let me know `:)`
2019-02-12Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnikbors-4/+4
Cosmetic improvements to doc comments This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase). r? @steveklabnik Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-12Stabilize linker-plugin based LTO.Michael Woerister-4/+4
2019-02-12rustc: Implement incremental "fat" LTOAlex Crichton-38/+101
Currently the compiler will produce an error if both incremental compilation and full fat LTO is requested. With recent changes and the advent of incremental ThinLTO, however, all the hard work is already done for us and it's actually not too bad to remove this error! This commit updates the codegen backend to allow incremental full fat LTO. The semantics are that the input modules to LTO are all produce incrementally, but the final LTO step is always done unconditionally regardless of whether the inputs changed or not. The only real incremental win we could have here is if zero of the input modules changed, but that's so rare it's unlikely to be worthwhile to implement such a code path. cc #57968 cc rust-lang/cargo#6643
2019-02-10rustc: doc commentsAlexander Regueiro-4/+4
2019-02-10rpath computation: explain why we pop()Ralf Jung-2/+2
2019-01-24Implement optimize(size) and optimize(speed)Simonas Kazlauskas-24/+31
2018-12-25Remove licensesMark Rousskov-70/+0
2018-12-18Search other library paths when loking for link objectsPetr Hosek-5/+19
Support the case when link objects are not located in Rust sysroot but in other locations which could be specify through library paths.
2018-12-12Replace `FileSearch::for_each_lib_search_path` with `search_paths`.Nicholas Nethercote-8/+4
Returning an iterator leads to nicer code all around.
2018-12-12Introduce `SearchPath` and replace `SearchPaths` with `Vec<SearchPath>`.Nicholas Nethercote-6/+6
It's more idiomatic, makes the code shorter, and will help with the next commit.
2018-12-12Remove `Session::sysroot()`.Nicholas Nethercote-2/+1
Instead of maybe storing its own sysroot and maybe deferring to the one in `Session::opts`, just clone the latter when necessary so one is always directly available. This removes the need for the getter.
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-5/+5
2018-12-04Serialize modules into ThinBuffer after initial optimizationNikita Popov-32/+33
Instead of keeping all modules in memory until thin LTO and only serializing them then, serialize the module immediately after it finishes optimizing.
2018-12-04Remove unnecessary parts of run_fat_lto signatureNikita Popov-12/+5
Fat LTO merges into one module, so only return one module.
2018-12-04Separate out methods for running thin and fat LTONikita Popov-37/+50
2018-12-03codegen_llvm_back: improve allocationsljedrz-18/+19
2018-12-03Auto merge of #56358 - nikic:mergefunc-aliases, r=rkruppebors-4/+5
Enable -mergefunc-use-aliases If the Rust LLVM fork is used, enable the -mergefunc-use-aliases flag, which will create aliases for merged functions, rather than inserting a call from one to the other. A number of codegen tests needed to be adjusted, because functions that previously fell below the thunk limit are now being merged. Merging is prevented in various ways now. I expect that this is going to break something, somewhere, because it isn't able to deal with aliases properly, but we won't find out until we try :) This fixes #52651. r? @rkruppe
2018-12-02Run name-anon-globals after all other passesNikita Popov-4/+5
name-anon-globals should always be run at the very end of the pass pipeline, as optimization passes (in particular mergefunc) may introduce new anonymous globals. I believe we did not run into this earlier because it requires the rather specific combination of a) mergefunc merging two weak functions b) compilation not using thinlto.
2018-12-01Rollup merge of #56341 - frewsxcv:frewsxcv-util-cstr, r=Mark-Simulacrumkennytm-5/+5
Rename conversion util; remove duplicate util in librustc_codegen_llvm.
2018-11-29Rename conversion util; remove duplicate util in librustc_codegen_llvm.Corey Farwell-5/+5
2018-11-25Rollup merge of #56075 - alexcrichton:wasm-producer-section, r=estebankPietro Albini-0/+112
Encode a custom "producers" section in wasm files This commit implements WebAssembly/tool-conventions#65 for wasm files produced by the Rust compiler. This adds a bit of metadata to wasm modules to indicate that the file's language includes Rust and the file's "processed-by" tools includes rustc. The thinking with this section is to eventually have telemetry in browsers tracking all this.
2018-11-22Pass additional linker flags when targeting FuchsiaPetr Hosek-1/+9
This is a follow up to 8aa9267 which changed the driver to use lld directly rather than invoking it through Clang. This change ensures we pass all the necessary flags to lld.
2018-11-19Encode a custom "producers" section in wasm filesAlex Crichton-0/+112
This commit implements WebAssembly/tool-conventions#65 for wasm files produced by the Rust compiler. This adds a bit of metadata to wasm modules to indicate that the file's language includes Rust and the file's "processed-by" tools includes rustc. The thinking with this section is to eventually have telemetry in browsers tracking all this.
2018-11-16[eddyb] rustc_codegen_ssa: rename `interfaces` to `traits`.Eduard-Mihai Burtescu-2/+2