about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2020-04-10fix rustc-dev-guide url in src/librustc_codegen_ssalongfangsong-1/+1
2020-04-09Rollup merge of #70868 - petrochenkov:linkorder, r=nagisa,mati865Mazdak Farrokhzad-261/+413
rustc_codegen_ssa: Refactor construction of linker arguments And add comments. This PR doesn't reorder any linker arguments and therefore shouldn't contain any observable changes. The next goal here is to - Factor out order-independent linker arguments in the compiler code and in target specifications and pass them together. Such arguments generally apply to the whole linking session or the produced linking result rather to individual object files or libraries. - Figure out where exactly among the remaining order-dependent arguments we should place customization points like `-C link-args` and `-Z pre-link-args`. - Possibly provide command line opt-outs for options that are currently passed unconditionally (like CRT objects or arguments defined by the target spec). - Document and stabilize the customization points that are not yet stable (https://github.com/rust-lang/rust/pull/70505).
2020-04-07linker: Some minor code cleanupVadim Petrochenkov-58/+38
2020-04-07Use assoc integer constants in librustc_*Linus Färnstrand-2/+2
2020-04-07linker: Factor out more parts of `linker_with_args` and add some docsVadim Petrochenkov-121/+183
2020-04-07linker: Add more markup and comments to code producing linker argumentsVadim Petrochenkov-23/+61
2020-04-07linker: Factor out addition of pre-, post- and late link argsVadim Petrochenkov-35/+82
2020-04-07linker: Factor out linking of pre- and post-link objectsVadim Petrochenkov-23/+37
2020-04-07linker: Combine argument building into a single functionVadim Petrochenkov-115/+118
2020-04-07linker: Make argument building interface in `trait Linker` richerVadim Petrochenkov-24/+32
by redirecting everything to `Command`
2020-04-06Rollup merge of #70665 - petrochenkov:linkargs, r=nagisaMazdak Farrokhzad-16/+8
Do not lose or reorder user-provided linker arguments Linker arguments are potentially order-dependent, so the order in which `-C link-arg` and `-C link-args` options are passed to `rustc` should be preserved when they are passed further to the linker. Also, multiple `-C link-args` options are now appended to each other rather than overwrite each other. In other words, `-C link-arg=a -C link-args="b c" -C link-args="d e" -C link-arg=f` is now passed as `"a" "b" "c" "d" "e" "f"` and not as `"d" "e" "a" "f"`. Addresses https://github.com/rust-lang/rust/pull/70505#issuecomment-606780163.
2020-04-05Stop importing int/float modules in librustc_*Linus Färnstrand-2/+0
2020-04-04Do not lose or reorder user-provided linker argumentsVadim Petrochenkov-16/+8
2020-04-02direct imports for langitem stuffMazdak Farrokhzad-9/+8
2020-04-02use direct import for ErrorReportedMazdak Farrokhzad-1/+1
2020-04-02nix rustc_target::abi::* reexport in ty::layoutMazdak Farrokhzad-61/+58
2020-04-01Rollup merge of #70616 - anyska:fieldplacement-rename, r=oli-obkDylan DPC-1/+1
rustc_target::abi: rename FieldPlacement to FieldsShape. Originally suggested by @eddyb.
2020-03-31Use Place directly in codegen_place_to_pointer, it's CopySantiago Pastorino-3/+3
2020-03-31Use Place directly in evaluate_array_len, it's CopySantiago Pastorino-2/+2
2020-03-31Use Place directly in codegen_transmute, it's CopySantiago Pastorino-2/+2
2020-03-31Use Place directly on make_return_dest, it's CopySantiago Pastorino-2/+2
2020-03-31Use Place directly on codegen_drop_terminator, it's CopySantiago Pastorino-2/+2
2020-03-31rustc_target::abi: rename FieldPlacement to FieldsShape.Ana-Maria Mihalache-1/+1
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-34/+36
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-104/+104
2020-03-30rustc -> rustc_middle part 1Mazdak Farrokhzad-1/+1
2020-03-30Auto merge of #70449 - ecstatic-morse:visit-body, r=oli-obkbors-1/+1
Make `Visitor::visit_body` take a plain `&Body` `ReadOnlyBodyAndCache` has replaced `&Body` in many parts of the code base that don't care about basic block predecessors. This includes the MIR `Visitor` trait, which I suspect resulted in many unnecessary changes in #64736. This reverts part of that PR to reduce the number of places where we need to pass a `ReadOnlyBodyAndCache`. In the long term, we should either give `ReadOnlyBodyAndCache` more ergonomic name and replace all uses of `&mir::Body` with it at the cost of carrying an extra pointer everywhere, or use it only in places that actually need access to the predecessor cache. Perhaps there is an even nicer alternative. r? @Nashenas88
2020-03-29Use `&` to do deref coercion for `ReadOnlyBodyAndCache`Dylan MacKenzie-1/+1
2020-03-29Rollup merge of #69702 - anyska:tylayout-rename, r=oli-obkDylan DPC-26/+30
Rename TyLayout to TyAndLayout.
2020-03-29Make `Visitor::visit_body` take a simple `Body`Dylan MacKenzie-1/+1
2020-03-28Auto merge of #70095 - jsgf:link-native, r=nagisabors-3/+10
Implement -Zlink-native-libraries This implements a flag `-Zlink-native-libraries=yes/no`. If set to true/yes, or unspecified, then native libraries referenced via `#[link]` attributes will be put on the linker line (ie, unchanged behaviour). If `-Zlink-native-libraries=no` is specified then rustc will not add the native libraries to the link line. The assumption is that the outer build system driving the build already knows about the native libraries and will specify them to the linker directly (for example via `-Clink-arg=`). Addresses issue #70093
2020-03-27Rollup merge of #70345 - nnethercote:rm-no_integrated_as, r=alexcrichtonMazdak Farrokhzad-65/+1
Remove `no_integrated_as` mode. Specifically, remove both `-Z no_integrated_as` and `TargetOptions::no_integrated_as`. The latter was only used for the `msp430_none_elf` platform, for which it's no longer required. r? @alexcrichton
2020-03-27Implement -Zlink-native-librariesJeremy Fitzhardinge-3/+10
This implements a flag `-Zlink-native-libraries=yes/no`. If set to true/yes, or unspecified, then native libraries referenced via `#[link]` attributes will be put on the linker line (ie, unchanged behaviour). If `-Zlink-native-libraries=no` is specified then rustc will not add the native libraries to the link line. The assumption is that the outer build system driving the build already knows about the native libraries and will specify them to the linker directly (for example via `-Clink-arg=`). Addresses issue #70093
2020-03-27Rename TyLayout to TyAndLayout.Ana-Maria Mihalache-26/+30
2020-03-27Rollup merge of #70068 - jclulow:illumos-gcc, r=cramertjDylan DPC-1/+13
use "gcc" instead of "cc" on *-sun-solaris systems when linking On illumos and Solaris systems, Rust will use GCC as the link editor. Rust does this by invoking "cc", which on many (Linux and perhaps BSD) systems is generally either GCC or a GCC-compatible front-end. On historical Solaris systems, "cc" was often the Sun Studio compiler. This history casts a long shadow, and as such, even most modern illumos-based operating systems tend to install GCC as "gcc", without also making it available as "cc". We should invoke GCC as "gcc" on such systems to ensure we get the right compiler driver.
2020-03-27Auto merge of #68404 - Amanieu:llvm-asm, r=estebankbors-5/+5
Rename asm! to llvm_asm! As per https://github.com/rust-lang/rfcs/pull/2843, this PR renames `asm!` to `llvm_asm!`. It also renames the compiler's internal `InlineAsm` data structures to `LlvmInlineAsm` in preparation for the new `asm!` functionality specified in https://github.com/rust-lang/rfcs/pull/2850. This PR doesn't actually deprecate `asm!` yet, it just makes it redirect to `llvm_asm!`. This is necessary because we first need to update the submodules (in particular stdarch) to use `llvm_asm!`.
2020-03-27Remove `no_integrated_as` mode.Nicholas Nethercote-65/+1
Specifically, remove both `-Z no_integrated_as` and `TargetOptions::no_integrated_as`. The latter was only used for the `msp430_none_elf` platform, for which it's no longer required.
2020-03-26Rollup merge of #70384 - nnethercote:refactor-object-file-handling, ↵Dylan DPC-33/+49
r=alexcrichton Refactor object file handling Some preliminary clean-ups that grease the path to #66961. r? @alexcrichton
2020-03-26Rename asm! to llvm_asm!Amanieu d'Antras-5/+5
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-26Introduce `EmitObj`.Nicholas Nethercote-32/+49
Currently, there are three fields in `ModuleConfig` that dictate how object files are emitted: `emit_obj`, `obj_is_bitcode`, and `embed_bitcode`. Some of the combinations of these fields are nonsensical, in particular having both `obj_is_bitcode` and `embed_bitcode` true at the same time. Also, currently: - we needlessly emit and then delete a bytecode file if `obj_is_bitcode` is true but `emit_obj` is false; - we needlessly embed bitcode in the LLVM module if `embed_bitcode` is true and `emit_obj` is false. This commit combines the three fields into one, with a new type `EmitObj` (and the auxiliary `BitcodeSection`) which can encode five different possibilities. In the old code, `set_flags` would set `obj_is_bitcode` and `embed_bitcode` on all three of the configs (`modules`, `allocator`, `metadata`) if the relevant other conditions were met, even if no object code needed to be emitted for one or more of them. Whereas `start_async_codegen` would set `emit_obj`, but only for those configs that need it. In the new code, `start_async_codegen` does all the work of setting `emit_obj`, and it only does that for the configs that need it. `set_flags` no longer sets anything related to object file emission.
2020-03-25make Size::from* methods generic in the integer type they acceptRalf Jung-1/+1
2020-03-25Remove `TargetOptions::embed_bitcode`.Nicholas Nethercote-9/+8
It's unused by any existing targets, and soon we'll be embedding full bitcode by default anyway.
2020-03-24Rollup merge of #70289 - nnethercote:refactor-codegen, r=eddybMazdak Farrokhzad-17/+22
Refactor `codegen` `codegen` in `src/librustc_codegen_llvm/back/write.rs` is long and has complex control flow. These commits refactor it and make it easier to understand.
2020-03-23Evaluate repeat expression lengths as late as possibleOliver Scherer-0/+3
2020-03-23Rollup merge of #70249 - lcnr:issue70125, r=eddybMazdak Farrokhzad-24/+19
handle ConstKind::Unresolved after monomorphizing fixes #70125 r? @bjorn3
2020-03-23Combine `ModuleConfig::embed_bitcode{,_marker}`.Nicholas Nethercote-14/+22
Because the `(true, true)` combination isn't valid.
2020-03-22Rollup merge of #70254 - matthiaskrgr:cl4ppy, r=CentrilDylan DPC-7/+3
couple more clippy fixes (let_and_return, if_same_then_else) * summarize if-else-code with identical blocks (clippy::if_same_then_else) * don't create variable bindings just to return the bound value immediately (clippy::let_and_return)
2020-03-22simplify eval_mir_constantBastian Kauschke-13/+3
2020-03-22handle unevaluated consts after monomophizeBastian Kauschke-21/+26
2020-03-22don't create variable bindings just to return the bound value immediately ↵Matthias Krüger-7/+3
(clippy::let_and_return)