summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/back/write.rs
AgeCommit message (Collapse)AuthorLines
2018-09-14Rollup merge of #53950 - michaelwoerister:more-lto-cli, r=alexcrichtonkennytm-3/+2
Allow for opting out of ThinLTO and clean up LTO related cli flag handling. It turns out that there currently is no way to explicitly disable ThinLTO (except for the nightly-only `-Zthinlto` flag). This PR extends `-C lto` to take `yes` and `no` in addition to `thin` and `fat`. It should be backwards compatible. It also cleans up how LTO mode selection is handled. Note that merging the PR in the current state would make the new values for `-C lto` available on the stable channel. I think that would be fine but maybe some team should vote on it.
2018-09-05Auto merge of #53962 - michaelwoerister:close-thinlto-file-descriptors, ↵bors-1/+1
r=alexcrichton ThinLTO: Don't keep files open after mmaping them. Fixes #53947. r? @alexcrichton
2018-09-05Auto merge of #53878 - alexcrichton:wasm-atomics-feature, r=eddybbors-4/+13
rustc: Prepare the `atomics` feature for wasm This commit adds a few changes for atomic instructions on the `wasm32-unknown-unknown` target. Atomic instructions are not yet stable in WebAssembly itself but there are multiple implementations and LLVM has support for the proposed instruction set, so let's work on exposing it! Here there are a few inclusions: * The `atomics` feature was whitelisted for LLVM, allowing code in Rust to enable/disable/gate on this. * The `singlethread` option is turned off for wasm when the `atomics` feature is enabled. This means that by default wasm won't be lowering with atomics, but when atomics are enabled globally we'll turn off single-threaded mode to actually codegen atomics. This probably isn't what we'll want in the long term but for now it should work. * Finally the maximum atomic width is increased to 64 to reflect the current wasm spec.
2018-09-05ThinLTO: Don't keep files open after mmaping them (because it's not needed).Michael Woerister-1/+1
2018-09-05Allow for opting out of ThinLTO and clean up LTO related cli flag handling.Michael Woerister-3/+2
2018-09-03incr.ThinLTO: Do some cleanup and add some logging.Michael Woerister-41/+24
2018-08-31rustc: Prepare the `atomics` feature for wasmAlex Crichton-4/+13
This commit adds a few changes for atomic instructions on the `wasm32-unknown-unknown` target. Atomic instructions are not yet stable in WebAssembly itself but there are multiple implementations and LLVM has support for the proposed instruction set, so let's work on exposing it! Here there are a few inclusions: * The `atomics` feature was whitelisted for LLVM, allowing code in Rust to enable/disable/gate on this. * The `singlethread` option is turned off for wasm when the `atomics` feature is enabled. This means that by default wasm won't be lowering with atomics, but when atomics are enabled globally we'll turn off single-threaded mode to actually codegen atomics. This probably isn't what we'll want in the long term but for now it should work. * Finally the maximum atomic width is increased to 64 to reflect the current wasm spec.
2018-08-31Always add all modules to the global ThinLTO module analysis when compiling ↵Michael Woerister-126/+28
incrementally.
2018-08-31Support local ThinLTO with incremental compilation.Michael Woerister-156/+385
2018-08-28Fix warnings about the `native` target-cpuAlex Crichton-1/+2
This fixes a regression from #53031 where specifying `-C target-cpu=native` is printing a lot of warnings from LLVM about `native` being an unknown CPU. It turns out that `native` is indeed an unknown CPU and we have to perform a mapping to an actual CPU name, but this mapping is only performed in one location rather than all locations we inform LLVM about the target CPU. This commit centralizes the mapping of `native` to LLVM's value of the native CPU, ensuring that all locations we inform LLVM about the `target-cpu` it's never `native`. Closes #53322
2018-08-21Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkorkennytm-2/+2
Fix typos found by codespell.
2018-08-21Rollup merge of #53465 - bjorn3:remove_link_meta_struct, r=varkorkennytm-5/+6
Remove LinkMeta struct Fixes #53291
2018-08-20Auto merge of #52101 - japaric:linker-flavor, r=alexcrichtonbors-1/+3
try to infer linker flavor from linker name and vice versa This is a second take on PR #50359 that implements the logic proposed in https://github.com/rust-lang/rust/pull/50359#pullrequestreview-116663121 With this change it would become possible to link `thumb*` binaries using GNU's LD on stable as `-C linker=arm-none-eabi-ld` would be enough to change both the linker and the linker flavor from their default values of `arm-none-eabi-gcc` and `gcc`. To link `thumb*` binaries using rustc's LLD on stable `-Z linker-flavor` would need to be stabilized as `-C linker=rust-lld -Z linker-flavor=ld.lld` are both required to change the linker and the linker flavor, but this PR doesn't propose that. We would probably need some sort of stability guarantee around `rust-lld`'s name and availability to make linking with rustc's LLD truly stable. With this change it would also be possible to link `thumb*` binaries using a system installed LLD on stable using the `-C linker=ld.lld` flag (provided that `ld.lld` is a symlink to the system installed LLD). r? @alexcrichton
2018-08-19Fix typos found by codespell.Matthias Krüger-2/+2
2018-08-18Remove LinkMeta structbjorn3-5/+6
2018-08-15Use CGU name as LLVM module name and add some caching to CGU name generation.Michael Woerister-2/+1
2018-08-14Rollup merge of #53290 - whitequark:fix-35741, r=nagisakennytm-0/+3
Make LLVM emit assembly comments with -Z asm-comments Fixes #35741, and makes `-Z asm-comments` actually do something useful. Before: ``` .section .text.main,"ax",@progbits .globl main .p2align 4, 0x90 .type main,@function main: .cfi_startproc pushq %rax .cfi_def_cfa_offset 16 movslq %edi, %rax leaq _ZN1t4main17he95a7d4f1843730eE(%rip), %rdi movq %rsi, (%rsp) movq %rax, %rsi movq (%rsp), %rdx callq _ZN3std2rt10lang_start17h3121da83b2bc3697E movl %eax, %ecx movl %ecx, %eax popq %rcx .cfi_def_cfa_offset 8 retq .Lfunc_end8: .size main, .Lfunc_end8-main .cfi_endproc ``` After: ``` .section .text.main,"ax",@progbits .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: pushq %rax .cfi_def_cfa_offset 16 movslq %edi, %rax leaq _ZN1t4main17he95a7d4f1843730eE(%rip), %rdi movq %rsi, (%rsp) # 8-byte Spill movq %rax, %rsi movq (%rsp), %rdx # 8-byte Reload callq _ZN3std2rt10lang_start17h3121da83b2bc3697E movl %eax, %ecx movl %ecx, %eax popq %rcx .cfi_def_cfa_offset 8 retq .Lfunc_end8: .size main, .Lfunc_end8-main .cfi_endproc # -- End function ```
2018-08-12Make LLVM emit assembly comments with -Z asm-comments.whitequark-0/+3
Fixes #35741.
2018-08-10Introduce SmallCStr and use it where applicable.Michael Woerister-6/+4
2018-08-09address review commentsJorge Aparicio-11/+8
2018-08-09try to infer linker flavor from linker name and vice versaJorge Aparicio-6/+11
2018-08-09Move path2cstr to rustc_fs_utilMark Rousskov-2/+1
2018-08-09Move rustc::util::fs into separate (new) crateMark Rousskov-1/+1
2018-08-08Address review comments for #53031 and fix some merge fallout.Michael Woerister-1/+1
2018-08-07Set 'PrepareForThinLTO' whenever doing cross-language LTO.Michael Woerister-1/+2
2018-08-07Fix issue around dllimport and ThinLTO as LLD runs it.Michael Woerister-6/+18
2018-08-07Auto merge of #51007 - AstralSorcerer:master, r=nagisabors-0/+31
Make globals with private linkage unnamed. Fixes #50862. cc @oli-obk @nagisa
2018-08-04Normalize DebugInfoLevel to standard styleMark Rousskov-1/+1
2018-08-04Normalize variants of Passes to standard styleMark Rousskov-4/+3
2018-08-04Normalize variants of CrateType to standard styleMark Rousskov-3/+3
This is a clippy-breaking change.
2018-08-01Make sure we prepare for thin LTO whenever we are emitting bitcodeColin Pronovost-0/+31
Emitting LLVM bitcode uses ThinLTOBuffers, so we need to prepare for thin LTO or we will likely cause errors in LLVM.
2018-07-31rustc: Handle linker diagnostic from LLVMAlex Crichton-6/+7
Previously linker diagnostic were being hidden when two modules were linked together but failed to link. This commit fixes the situation by ensuring that we have a diagnostic handler installed and also adds support for handling linker diagnostics.
2018-07-30rustc_codegen_llvm: fix tidy errors.Irina Popa-1/+4
2018-07-30rustc_codegen_llvm: use safe references for PassManager.Irina Popa-46/+48
2018-07-30rustc_codegen_llvm: use safe references for Twine, DiagnosticInfo, SMDiagnostic.Irina Popa-5/+3
2018-07-30rustc_codegen_llvm: use safe references for TargetMachine.Irina Popa-3/+3
2018-07-30rustc_codegen_llvm: use safe references for Pass.Irina Popa-4/+4
2018-07-30rustc_codegen_llvm: use safe references for PassManagerBuilder.Irina Popa-1/+1
2018-07-30rustc_codegen_llvm: use safe references for Type.Irina Popa-3/+3
2018-07-30rustc_codegen_llvm: use safe references for Context and Module.Irina Popa-180/+177
2018-07-16Revert "Clean up LLVM module naming (just use CodegenUnit names)."Michael Woerister-1/+2
This reverts commit f6894ebe664d111259a91a2b5fcc1236ca413436.
2018-07-15Auto merge of #52381 - oli-obk:ty_to_def_id, r=eddybbors-11/+9
Remove `ty_to_def_id` fixes https://github.com/rust-lang/rust/issues/52341 The uses were mostly convenience and generally "too powerful" (would also have worked for types that weren't interesting at the use site) r? @eddyb
2018-07-15Ubsan this newly discovered dead codeOliver Schneider-14/+9
2018-07-14Expose a self-referential objectOliver Schneider-0/+3
2018-07-13Auto merge of #52266 - michaelwoerister:incr-thinlto-preliminaries, ↵bors-2/+1
r=alexcrichton Preliminary work for incremental ThinLTO. Since implementing incremental ThinLTO is a bit more involved than I initially thought, I'm splitting out some of the things that already work. This PR (1) adds a way accessing some ThinLTO information in `rustc` and (2) does some cleanup around CGU/object file naming (which makes things quite a bit nicer). This is probably best reviewed one commit at a time.
2018-07-11Clean up LLVM module naming (just use CodegenUnit names).Michael Woerister-2/+1
2018-07-11Rollup merge of #52252 - ljedrz:dyn_librustc_codegen_llvm, r=varkorMark Rousskov-8/+8
Deny bare trait objects in in src/librustc_codegen_llvm Enforce `#![deny(bare_trait_objects)]` in `src/librustc_codegen_llvm`.
2018-07-11Auto merge of #51230 - nikic:no-verify-lto, r=pnkfelixbors-4/+4
Disable LLVM verification by default Currently -Z no-verify only controls IR verification prior to LLVM codegen, while verification is performed unconditionally both before and after linking with (Thin)LTO. Also wondering what the sentiment is on disabling verification by default (and e.g. only enabling it on ALT builds with assertions). This does not seem terribly useful outside of rustc development and it does seem to show up in profiles (at something like 3%). **EDIT:** A table showing the various configurations and what is enabled when. | Configuration | Dynamic verification performed | LLVM static assertions compiled in | | --- | --- | --- | | alt builds | | yes | | nightly builds | | no | | stable builds | | no | | CI builds | | | | dev builds in a checkout | | |
2018-07-11Deny bare trait objects in in src/librustc_codegen_llvmljedrz-8/+8
2018-07-06When doing linker-plugin based LTO, write LLVM bitcode obj-filesMichael Woerister-4/+4
instead of embedding the bitcode into the regular object file.