about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
AgeCommit message (Collapse)AuthorLines
2020-04-11Auto merge of #70161 - cjgillot:query-arena, r=nikomatsakisbors-5/+4
Allocate some query results on an arena This avoids a cloning few `Lrc` and `Vec`s in the queries.
2020-04-07fix abuses of tykind::errmark-2/+2
2020-04-05Rollup merge of #70777 - faern:use-assoc-int-consts2, r=dtolnayDylan DPC-1/+1
Don't import integer and float modules, use assoc consts Stop importing the standard library integer and float modules to reach the `MIN`, `MAX` and other constants. They are available directly on the primitive types now. This PR is a follow up of #69860 which made sure we use the new constants in documentation. This type of change touches a lot of files, and previously all my assoc int consts PRs had collisions and were accepted only after a long delay. So I'd prefer to do it in smaller steps now. Just removing these imports seem like a good next step. r? @dtolnay
2020-04-05Remove Arcs in queries.Camille GILLOT-5/+4
2020-04-05Stop importing int/float modules in librustc_*Linus Färnstrand-1/+1
2020-04-05Fix performance regression in debuginfo file_metadata.Arlo Siemsen-11/+10
Finding the `SourceFile` associated with a `FileName` called `get_source_file` on the `SourceMap`, which does a linear search through all files in the `SourceMap`. This resolves the issue by passing the SourceFile in from the caller (which already had it available).
2020-04-04Auto merge of #69718 - arlosi:debughash, r=eddybbors-3/+43
Add hash of source files in debug info LLVM supports placing the hash of source files inside the debug info. This information can be used by a debugger to verify that the source code matches the executable. This change adds support for both hash algorithms supported by LLVM, MD5 and SHA1, controlled by a target option. * DWARF only supports MD5 * LLVM IR supports MD5 and SHA1 (and SHA256 in LLVM 11). * CodeView (.PDB) supports MD5, SHA1, and SHA256. Fixes #68980. Tracking issue: #70401 rustc dev guide PR with further details: https://github.com/rust-lang/rustc-dev-guide/pull/623
2020-04-03Rollup merge of #70720 - ecstatic-morse:issue-70637, r=oli-obkMazdak Farrokhzad-16/+13
Place TLS initializers with relocations in .tdata Should fix #70673, although I'm not sure how to test this. Perhaps @joshlf could find a MCVE? Also adds more context to the FIXME. r? @oli-obk
2020-04-03Rollup merge of #70487 - Mark-Simulacrum:float-unchecked-casts, r=SimonSapinMazdak Farrokhzad-3/+3
Stabilize float::to_int_unchecked This renames and stabilizes unsafe floating point to integer casts, which are intended to be the substitute for the currently unsound `as` behavior, once that changes to safe-but-slower saturating casts. As such, I believe this also likely unblocks #10184 (our oldest I-unsound issue!), as once this rolls out to stable it would be far easier IMO to change the behavior of `as` to be safe by default. This does not stabilize the trait or the associated method, as they are deemed internal implementation details (and consumers should not, generally, want to expose them, as in practice all callers likely know statically/without generics what the return type is). Closes #67058
2020-04-02Add hash of source files in debug infoArlo Siemsen-3/+43
* Adds either an MD5 or SHA1 hash to the debug info. * Adds new unstable option `-Z src-hash-algorithm` to control the hashing algorithm.
2020-04-02Place TLS initializers with relocations in .tdataDylan MacKenzie-16/+13
2020-04-02use direct import for ErrorReportedMazdak Farrokhzad-2/+1
2020-04-02nix rustc_target::abi::* reexport in ty::layoutMazdak Farrokhzad-149/+125
2020-04-01Rollup merge of #70616 - anyska:fieldplacement-rename, r=oli-obkDylan DPC-6/+6
rustc_target::abi: rename FieldPlacement to FieldsShape. Originally suggested by @eddyb.
2020-04-01Rollup merge of #70547 - wesleywiser:extract_can_unwind, r=eddybMazdak Farrokhzad-58/+11
Add `can_unwind` field to `FnAbi` This is a pure refactoring with no behavior changes. Extracted out of #70467 r? @eddyb
2020-03-31Address review feedbackWesley Wiser-18/+11
2020-03-31rustc_target::abi: rename FieldPlacement to FieldsShape.Ana-Maria Mihalache-6/+6
2020-03-30Add `can_unwind` field to `FnAbi`Wesley Wiser-41/+1
This is a pure refactoring with no behavior changes.
2020-03-30Fix broken link in READMEYoungsuk Kim-1/+1
2020-03-30Use if let instead of match when only matching a single variant ↵Matthias Krüger-10/+8
(clippy::single_match) Makes code more compact and reduces nestig.
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-40/+41
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-90/+90
2020-03-30rustc -> rustc_middle part 1Mazdak Farrokhzad-1/+1
2020-03-29Rollup merge of #69702 - anyska:tylayout-rename, r=oli-obkDylan DPC-30/+30
Rename TyLayout to TyAndLayout.
2020-03-29Stabilize float::to_int_uncheckedMark Rousskov-3/+3
This renames and stabilizes unsafe floating point to integer casts, which are intended to be the substitute for the currently unsound `as` behavior, once that changes to safe-but-slower saturating casts.
2020-03-29reduce rustc_attr usage in placesMazdak Farrokhzad-1/+1
2020-03-28Auto merge of #70483 - Centril:rollup-slli4yf, r=Centrilbors-38/+25
Rollup of 5 pull requests Successful merges: - #70345 (Remove `no_integrated_as` mode.) - #70434 (suggest `;` on expr `mac!()` which is good as stmt `mac!()`) - #70457 (non-exhastive diagnostic: add note re. scrutinee type) - #70478 (Refactor type_of for constants) - #70480 (clarify hir_id <-> node_id method names) Failed merges: r? @ghost
2020-03-27Rollup merge of #70345 - nnethercote:rm-no_integrated_as, r=alexcrichtonMazdak Farrokhzad-38/+25
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-27Auto merge of #70162 - cjgillot:split_query, r=Zoxcbors-3/+0
Move the query system to a dedicated crate The query system `rustc::ty::query` is split out into the `rustc_query_system` crate. Some commits are unformatted, to ease rebasing. Based on #67761 and #69910. r? @Zoxc
2020-03-27Rename TyLayout to TyAndLayout.Ana-Maria Mihalache-30/+30
2020-03-27Auto merge of #68404 - Amanieu:llvm-asm, r=estebankbors-6/+6
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-38/+25
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-40/+47
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-6/+6
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-26Retire DepGraphSafe and HashStableContext.Camille GILLOT-3/+0
2020-03-26Convert a chained if-else to a match.Nicholas Nethercote-33/+42
It makes things a little clearer.
2020-03-26Introduce `EmitObj`.Nicholas Nethercote-17/+15
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-25Rollup merge of #70226 - RalfJung:checked, r=oli-obkDylan DPC-18/+16
use checked casts and arithmetic in Miri engine This is unfortunately pretty annoying because we have to cast back and forth between `u64` and `usize` more often that should be necessary, and that cast is considered fallible. For example, should [this](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/mir/interpret/value/enum.ConstValue.html) really be `usize`? Also, `LayoutDetails` uses `usize` for field indices, but in Miri we use `u64` to be able to also handle array indexing. Maybe methods like `mplace_field` should be suitably generalized to accept both `u64` and `usize`? r? @oli-obk Cc @eddyb
2020-03-25make bit_width return u64, consistently with other sizes in the compilerRalf Jung-18/+16
2020-03-25Auto merge of #70297 - nnethercote:clean-up-debugging-options, ↵bors-2/+1
r=michaelwoerister Clean up debugging options I found various sub-optimal things when I was looking at option handling.
2020-03-25Rollup merge of #70373 - Centril:canon-imports, r=Mark-SimulacrumMazdak Farrokhzad-1/+1
normalize some imports & prefer direct ones r? @Mark-Simulacrum
2020-03-24normalize some imports, prefer direct ones.Mazdak Farrokhzad-1/+1
2020-03-24Rollup merge of #70289 - nnethercote:refactor-codegen, r=eddybMazdak Farrokhzad-92/+82
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-24Invert `-Z generate-arange-section`.Nicholas Nethercote-2/+1
Because it uses `parse_bool` and defaults to true, it is actually impossible to set it to false. Inverting its sense to `-Z no-generate-arange-section` makes it usable.
2020-03-23Rollup merge of #69968 - eddyb:tupled-closure-captures, r=nikomatsakisMazdak Farrokhzad-2/+2
rustc: keep upvars tupled in {Closure,Generator}Substs. Previously, each closure/generator capture's (aka "upvar") type was tracked as one "synthetic" type parameter in the closure/generator substs, and figuring out where the parent `fn`'s generics end and the synthetics start involved slicing at `tcx.generics_of(def_id).parent_count`. Needing to query `generics_of` limited @davidtwco (who wants to compute some `TypeFlags` differently for parent generics vs upvars, and `TyCtxt` is not available there), which is how I got started on this, but it's also possible that the `generics_of` queries are slowing down `{Closure,Generator}Substs` methods. To give an example, for a `foo::<T, U>::{closure#0}` with captures `x: X` and `y: Y`, substs are: * before this PR: `[T, U, /*kind*/, /*signature*/, X, Y]` * after this PR: `[T, U, /*kind*/, /*signature*/, (X, Y)]` You can see that, with this PR, no matter how many captures, the last 3 entries in the substs (or 5 for a generator) are always the "synthetic" ones, with the last one being the tuple of capture types. r? @nikomatsakis cc @Zoxc
2020-03-23Rollup merge of #69940 - tmiasko:llvm-api, r=hanna-kruppeMazdak Farrokhzad-16/+23
librustc_codegen_llvm: Replace deprecated API usage
2020-03-23rustc_codegen_llvm: don't generate static and vtable debuginfo for ↵Eduard-Mihai Burtescu-0/+10
-Cdebuginfo=1.
2020-03-23rustc_codegen_llvm: don't generate Self type debuginfo for methods for ↵Eduard-Mihai Burtescu-1/+6
-Cdebuginfo=1.
2020-03-23rustc_codegen_llvm: don't generate "lexical block" scopes for -Cdebuginfo=1.Eduard-Mihai Burtescu-4/+13
2020-03-23Factor out a repeated `config.no_integrated_as` test.Nicholas Nethercote-23/+25