Commit graph

345 commits

Author SHA1 Message Date
bjorn3
f04a2d308e Provide default MetadataLoader 2021-06-04 13:20:04 +02:00
bjorn3
f299256854 Remove unnecessary wasm_import_module_map provide
For extern providers, both provide and provide_extern are called.
wasm_import_module_map is already provided in provide, so it doesn't
need to be provided in provide_extern.
2021-06-04 13:20:04 +02:00
bjorn3
092bc2b744 Provide a default provide* implementation for CodegenBackend
Both cg_llvm and cg_clif don't override it. cg_spirv does override it,
so it needs to be preserved.
2021-06-04 13:20:04 +02:00
Yuki Okushi
36f1ed6de2
Rollup merge of #85850 - bjorn3:less_feature_gates, r=jyn514
Remove unused feature gates

The first commit removes a usage of a feature gate, but I don't expect it to be controversial as the feature gate was only used to workaround a limitation of rust in the past. (closures never being `Clone`)

The second commit uses `#[allow_internal_unstable]` to avoid leaking the `trusted_step` feature gate usage from inside the index newtype macro. It didn't work for the `min_specialization` feature gate though.

The third commit removes (almost) all feature gates from the compiler that weren't used anyway.
2021-06-04 13:42:54 +09:00
Wesley Wiser
3127419e2b Respond to review feedback 2021-06-02 10:23:12 -04:00
Wesley Wiser
ef053fd6f0 Change the type name from _enum<..> to enum$<..>
This makes the type name inline with the proposed standard in #85269.
2021-06-02 10:23:12 -04:00
Wesley Wiser
141546c355 Generate better debuginfo for niche-layout enums
Previously, we would generate a single struct with the layout of the
dataful variant plus an extra field whose name contained the value of
the niche (this would only really work for things like `Option<&_>`
where we can determine that the `None` case maps to `0` but for enums
that have multiple tag only variants, this doesn't work).

Now, we generate a union of two structs, one which is the layout of the
dataful variant and one which just has a way of reading the
discriminant. We also generate an enum which maps the discriminant value
to the tag only variants.

We also encode information about the range of values which correspond to
the dataful variant in the type name and then use natvis to determine
which union field we should display to the user.

As a result of this change, all niche-layout enums render correctly in
WinDbg and Visual Studio!
2021-06-02 10:23:10 -04:00
Wesley Wiser
f353cbf1a1 Generate better debuginfo for directly tagged enums 2021-06-02 10:23:09 -04:00
Camille Gillot
0f0f3138cb
Revert "Reduce the amount of untracked state in TyCtxt" 2021-06-01 09:05:22 +02:00
bjorn3
312f964478 Remove unused feature gates 2021-05-31 13:55:43 +02:00
Camille GILLOT
ee94fbb607 Make allocator_kind a query. 2021-05-30 19:58:01 +02:00
Dylan DPC
0c53acc6f8
Rollup merge of #85649 - ChrisDenton:update-cc, r=matthewjasper
Update cc

Recent commits have improved `cc`'s finding of MSVC tools on Windows. In particular it should help to address these issues: #83043 and #43468
2021-05-27 03:02:09 +02:00
Chris Denton
e238ee31d4
Update cc
Recent commits to cc have helped to address #83043 and #43468
2021-05-24 23:34:12 +01:00
Pietro Albini
9e22b844dd remove cfg(bootstrap) 2021-05-24 11:07:48 -04:00
12101111
004614c4b3
native lib: defer the duplicate check after relevant_lib check. 2021-05-22 00:09:07 +08:00
bors
8a57820bca Auto merge of #84665 - adamgemmell:aarch64-features, r=Amanieu
Update list of allowed aarch64 features

I recently added these features to std_detect for aarch64 linux, pending [review](https://github.com/rust-lang/stdarch/pull/1146).

I have commented any features not supported by LLVM 9, the current minimum version for Rust. Some (PAuth at least) were renamed between 9 & 12 and I've left them disabled. TME, however, is not in LLVM 9 but I've left it enabled.

See https://github.com/rust-lang/stdarch/issues/993
2021-05-20 13:07:35 +00:00
Adam Gemmell
904467a926 Ensure all crypto components (AES, PMULL, SHA1/2) are available on arm/aarch64 2021-05-19 16:13:23 +01:00
Adam Gemmell
c71e58d432 Rename fptoint to frintts 2021-05-19 16:12:30 +01:00
Adam Gemmell
523b4d1499 Remove LSE2 2021-05-19 16:11:11 +01:00
Jack Huey
ec0e0d1e7a
Rollup merge of #85274 - luqmana:linker-is-gnu-gc-sections, r=petrochenkov
Only pass --[no-]gc-sections if linker is GNU ld.

Fixes a regression from #84468 where linking now fails with solaris linkers. LinkerFlavor::Gcc does not always mean GNU ld specifically. And in the case of at least the solaris ld in illumos, that flag is unrecognized and will cause the linking step to fail.

Even though removing the `is_like_solaris` branch from `gc_sections` in #84468 made sense as `-z ignore/record` are more analogous to the `--[no-]-as-needed` flags, it inadvertently caused solaris linkers to be passed the `--gc-sections` flag. So let's just change it to be more explicit about when we pass those flags.
2021-05-18 22:36:04 -04:00
Luqman Aden
ac5fd90d82 Don't pass -pie to linker on windows targets. 2021-05-18 03:57:53 -07:00
Luqman Aden
e0d5872503 Undo unnecessary changes. 2021-05-18 02:44:07 -07:00
Luqman Aden
a862b1f6cc Adjust linker_is_gnu branches for cases that don't work on windows. 2021-05-17 16:14:13 -07:00
bors
3396a383bb Auto merge of #85178 - cjgillot:local-crate, r=oli-obk
Remove CrateNum parameter for queries that only work on local crate

The pervasive `CrateNum` parameter is a remnant of the multi-crate rustc idea.

Using `()` as query key in those cases avoids having to worry about the validity of the query key.
2021-05-17 01:42:03 +00:00
Eduard-Mihai Burtescu
0fcaf11455 rustc_codegen_ssa: append blocks to functions w/o creating a builder. 2021-05-17 00:04:09 +03:00
Eduard-Mihai Burtescu
402e9efc56 rustc_codegen_ssa: only create backend BasicBlocks as-needed. 2021-05-17 00:04:09 +03:00
bors
7dc9ff5c62 Auto merge of #85290 - Amanieu:asm_const_int, r=nagisa
Remove support for floating-point constants in asm!

Floating-point constants aren't very useful anyways and this simplifies
the code since the type check can now be done in typeck.

cc `@rust-lang/wg-inline-asm`

r? `@nagisa`
2021-05-16 17:52:52 +00:00
bors
747a5d2a5d Auto merge of #85316 - eddyb:cg-ssa-on-demand-cleanuppad, r=nagisa
rustc_codegen_ssa: generate MSVC cleanup pads on demand, like GNU landing pads.

This unblocks #84993 in terms of codegen tests, as it brings the MSVC-style (`cleanup_pad`) EH (LLVM) block order in line with the GNU-style (`landing_pad`) EH (LLVM) block order, by having both of them be on-demand (instead of MSVC-style being eager and GNU-style lazy/on-demand).

It also unifies the two implementations a bit, similar to #84699, but in the opposite direction (as that attempt made both kinds of EH pads eagerly built).

~~Opening as draft because I haven't done enough Windows testing just yet, of both this PR, and of #84993 rebased on it.~~ (**EDIT**: seems to be working as expected)

r? `@nagisa`
2021-05-16 12:30:07 +00:00
Guillaume Gomez
e611e64e3a
Rollup merge of #85215 - richkadel:ice-fixes-minus-dead-blocks, r=tmandry
coverage bug fixes and some refactoring

This replaces the relevant commits (2 and 3) from PR #85082, and also corrects an error querying for coverageinfo.

1. `coverageinfo` query needs to use the same MIR as codegen

I ran into an error trying to fix dead block coverage and realized the
`coverageinfo` query is getting a different MIR compared to the
codegenned MIR, which can sometimes be a problem during mapgen.

I changed that query to use the `InstandeDef` (which includes the
generic parameter substitutions, prosibly specific to const params)
instead of the `DefId` (without unknown/default const substitutions).

2. Simplified body_span and filtered span code

  Some code cleanup extracted from future (but unfinished) commit to fix
  coverage in attr macro functions.

3. Spanview needs the relevant body_span used for coverage

The coverage body_span doesn't always match the function body_span.

r? ```@tmandry```
2021-05-15 13:29:49 +02:00
Eduard-Mihai Burtescu
cb23a794a6 rustc_codegen_ssa: generate MSVC cleanup pads on demand, like GNU landing pads. 2021-05-15 09:17:46 +03:00
Amanieu d'Antras
f1b11939e2 Remove support for floating-point constants in asm!
Floating-point constants aren't very useful anyways and this simplifies
the code since the type check can now be done in typeck.
2021-05-14 14:58:21 +01:00
bors
75da570d78 Auto merge of #83640 - bjorn3:shared_metadata_reader, r=nagisa
Use the object crate for metadata reading

This allows sharing the metadata reader between cg_llvm, cg_clif and other codegen backends.

This is not currently useful for rlib reading with cg_spirv ([rust-gpu](https://github.com/EmbarkStudios/rust-gpu/)) as it uses tar rather than ar as .rlib format, but it is useful for dylib reading required for loading proc macros. (cc `@eddyb)`

The object crate is already trusted as dependency of libstd through backtrace. As far as I know it supports reading all object file formats used by targets for which we support rust dylibs with crate metadata, but I am not certain. If this happens to not be the case, I could keep using LLVM for reading dylib metadata.

Marked as WIP for a perf run and as it is based on #83637.
2021-05-14 12:58:58 +00:00
bors
91f2e2d218 Auto merge of #85190 - mati865:update-cc, r=Mark-Simulacrum
Update cc crate

To pull in this fix: 801a87bf2f
2021-05-14 04:12:40 +00:00
Luqman Aden
3fe1d7f789 Only pass --[no-]gc-sections if linker is GNU ld.
LinkerFlavor::Gcc does not always mean GNU ld specifically. And in the
case of at least the solaris ld in illumos, that flag is unrecognized
and will cause the linking step to fail.
2021-05-13 16:55:33 -07:00
Amanieu d'Antras
5918ee4317 Add support for const operands and options to global_asm!
On x86, the default syntax is also switched to Intel to match asm!
2021-05-13 22:31:57 +01:00
Rich Kadel
aed8ef5a4d coverageinfo query needs to use the same MIR as codegen
I ran into an error trying to fix dead block coverage and realized the
`coverageinfo` query is getting a different MIR compared to the
codegenned MIR, which can sometimes be a problem during mapgen.

I changed that query to use the `InstandeDef` (which includes the
generic parameter substitutions, prosibly specific to const params)
instead of the `DefId` (without unknown/default const substitutions).
2021-05-12 20:27:07 -07:00
Ralf Jung
44a8e8d745 entirely remove rustc_args_required_const attribute 2021-05-12 16:15:27 +02:00
Camille GILLOT
0bde3b1f80 Use () for codegen queries. 2021-05-12 13:58:46 +02:00
Camille GILLOT
437a46ddfa Use () for lang items. 2021-05-12 13:58:45 +02:00
Camille GILLOT
b7bf467fa3 Use () for proc_macro_decls_static. 2021-05-12 13:58:43 +02:00
Camille GILLOT
e9e1900af7 Use () for plugin_registrar_fn. 2021-05-12 13:58:43 +02:00
Camille GILLOT
829a9d33a9 Use () for entry_fn. 2021-05-12 13:58:42 +02:00
Camille GILLOT
3a729915da Use () in reachable_set. 2021-05-12 13:58:42 +02:00
Camille GILLOT
85a14d70bb Use () in dependency_formats. 2021-05-12 13:58:41 +02:00
bors
e1ff91f439 Auto merge of #83813 - cbeuw:remap-std, r=michaelwoerister
Fix `--remap-path-prefix` not correctly remapping `rust-src` component paths and unify handling of path mapping with virtualized paths

This PR fixes #73167 ("Binaries end up containing path to the rust-src component despite `--remap-path-prefix`") by preventing real local filesystem paths from reaching compilation output if the path is supposed to be remapped.

`RealFileName::Named` introduced in #72767 is now renamed as `LocalPath`, because this variant wraps a (most likely) valid local filesystem path.

`RealFileName::Devirtualized` is renamed as `Remapped` to be used for remapped path from a real path via `--remap-path-prefix` argument, as well as real path inferred from a virtualized (during compiler bootstrapping) `/rustc/...` path. The `local_path` field is now an `Option<PathBuf>`, as it will be set to `None` before serialisation, so it never reaches any build output. Attempting to serialise a non-`None` `local_path` will cause an assertion faliure.

When a path is remapped, a `RealFileName::Remapped` variant is created. The original path is preserved in `local_path` field and the remapped path is saved in `virtual_name` field. Previously, the `local_path` is directly modified which goes against its purpose of "suitable for reading from the file system on the local host".

`rustc_span::SourceFile`'s fields `unmapped_path` (introduced by #44940) and `name_was_remapped` (introduced by #41508 when `--remap-path-prefix` feature originally added) are removed, as these two pieces of information can be inferred from the `name` field: if it's anything other than a `FileName::Real(_)`, or if it is a `FileName::Real(RealFileName::LocalPath(_))`, then clearly `name_was_remapped` would've been false and `unmapped_path` would've been `None`. If it is a `FileName::Real(RealFileName::Remapped{local_path, virtual_name})`, then `name_was_remapped` would've been true and `unmapped_path` would've been `Some(local_path)`.

cc `@eddyb` who implemented `/rustc/...` path devirtualisation
2021-05-12 11:05:56 +00:00
bors
ac923d94f8 Auto merge of #83610 - bjorn3:driver_cleanup, r=cjgillot
rustc_driver cleanup

Best reviewed one commit at a time.
2021-05-12 08:38:03 +00:00
Mateusz Mikuła
b04fd78d66 update cc crate
To pull in this fix: 801a87bf2f
2021-05-12 00:55:03 +02:00
Simonas Kazlauskas
b7c5599d22 Adjust target search algorithm for rustlib path
With this the concerns expressed in #83800 should be addressed.
2021-05-10 19:15:19 +03:00
bjorn3
487427fbe6 Better error messages 2021-05-10 09:49:42 +02:00
bors
d29289c509 Auto merge of #84507 - crlf0710:codegen_nonlocal_main_wrapper, r=nagisa
Add primary marker on codegen unit and generate main wrapper on primary codegen.

This is the codegen part of changes extracted from #84062.

This add a marker called `primary` on each codegen units, where exactly one codegen unit will be `primary = true` at a time. This specific codegen unit will take charge of generating `main` wrapper when `main` is imported from a foreign crate after the implementation of RFC 1260.

cc #28937

I'm not sure who should i ask for review for codegen changes, so feel free to reassign.
r? `@nagisa`
2021-05-10 00:42:31 +00:00