about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2020-04-15Use `call` instead of `invoke` for functions that cannot unwindWesley Wiser-1/+3
The `FnAbi` now knows if the function is allowed to unwind. If a function isn't allowed to unwind, we can use a `call` instead of an `invoke`. This resolves an issue when calling LLVM intrinsics which cannot unwind LLVM will generate an error if you attempt to invoke them so we need to ignore cleanup blocks in codegen and generate a call instead.
2020-04-14Add illumos triplePatrick Mooney-2/+2
Co-Authored-By: Jason King <jason.brian.king@gmail.com> Co-Authored-By: Joshua M. Clulow <jmc@oxide.computer>
2020-04-13linker: Pass `/NODEFAULTLIB` in a more regular wayVadim Petrochenkov-16/+3
2020-04-13rustc_target: Make sure lld-link is treated as link.exe by defaultVadim Petrochenkov-2/+4
The differences if they are discovered will need to be explicitly documented
2020-04-11Auto merge of #71031 - Dylan-DPC:rollup-zr8hh86, r=Dylan-DPCbors-162/+140
Rollup of 5 pull requests Successful merges: - #70644 (Clean up `ModuleConfig` initialization) - #70937 (Fix staticlib name for *-pc-windows-gnu targets) - #70996 (Add or_insert_with_key to Entry of HashMap/BTreeMap) - #71020 (Store UNICODE_VERSION as a tuple) - #71021 (Use write!-style syntax for MIR assert terminator) Failed merges: r? @ghost
2020-04-11Rollup merge of #70644 - nnethercote:clean-up-ModuleConfig-init, ↵Dylan DPC-162/+140
r=Mark-Simulacrum Clean up `ModuleConfig` initialization Because it's currently a mess. r? @Mark-Simulacrum
2020-04-11Auto merge of #70161 - cjgillot:query-arena, r=nikomatsakisbors-9/+6
Allocate some query results on an arena This avoids a cloning few `Lrc` and `Vec`s in the queries.
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-05Remove Arcs in queries.Camille GILLOT-9/+6
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-04-01Rename `modules_config` as `regular_config`.Nicholas Nethercote-4/+4
That way it matches `ModuleKind::Regular`.
2020-04-01Improve `ModuleConfig` initialization.Nicholas Nethercote-152/+137
There are three `ModuleConfigs`, one for each `ModuleKind`. The code to initialized them is spaghetti imperative code that sets each field to a default value and then modifies many fields in complicated ways. This makes it very hard to tell what value ends up in each field in each config. For example, the `modules_config.emit_pre_lto_bc` field is set twice, which means it can be set to true and then incorrectly set back to false. (This probably hasn't been noticed because it happens in a very obscure case.) This commit changes the code to a declarative style in which `ModuleConfig::new` initializes all fields and then they are never changed again. This is slightly more concise and much easier to read. (And it fixes the abovementioned `emit_pre_lto_bc` error as well.)
2020-04-01Remove some dead code.Nicholas Nethercote-7/+0
The condition checks if `sess.opts.output_types` doesn't contain `OutputType::Assembly` within a match arm that is only reached if `sess.opts.output_types` contains `OutputType::Assembly`.
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.