Commit Graph

2150 Commits

Author SHA1 Message Date
Alan Egerton
4a7068dbfc
Ensure Instances are only jitted once 2021-06-17 09:42:38 +01:00
Alan Egerton
2945b96e58
Multithreading support for lazy-jit 2021-06-17 09:42:37 +01:00
Alexander
432285fbc6
Implement llvm.x86.addcarry.64 and llvm.x86.subborrow.64 (#1178) 2021-06-15 13:41:46 +02:00
bjorn3
75eff64977 Enable cross-compilation support in Cranelift 2021-06-10 12:18:10 +02:00
bjorn3
4492f32d15 Update Cranelift and object 2021-06-10 12:17:42 +02:00
bjorn3
ae1bcb209a Use -Cprefer-dynamic for all crates in jit mode 2021-06-10 11:18:59 +02:00
bjorn3
84dd22969f Include rustc and cranelift version in debuginfo 2021-06-10 11:18:59 +02:00
bjorn3
b7180ae39a Add missing cargo clean when cross-compiling 2021-06-10 11:18:59 +02:00
bjorn3
0d68742d37 Ignore unsupported test 2021-06-08 20:12:29 +02:00
bjorn3
a6cce19659 Rustup to rustc 1.54.0-nightly (e4a603270 2021-06-07) 2021-06-08 19:36:12 +02:00
bjorn3
dee7c7b075 Sync from rust a50d72158e 2021-06-08 19:22:10 +02:00
Yuki Okushi
8224e72fbc Rollup merge of #86016 - luqmana:infer-linker-flavor, r=petrochenkov
Unify duplicate linker_and_flavor methods in rustc_codegen_{cranelift,ssa}.

The two methods were exactly the same so this removes the cranelift copy. This will help make sure both they don't get out of sync.
2021-06-07 15:21:03 +09:00
bors
ab73115be0 Auto merge of #85810 - bjorn3:further_driver_cleanup, r=varkor
Driver improvements

This PR contains a couple of cleanups for the driver and a few small improvements for the custom codegen backend interface. It also implements `--version` and `-Cpasses=list` support for custom codegen backends.
2021-06-07 02:30:24 +00:00
Luqman Aden
20beb55565 Unify duplicate linker_and_flavor methods in rustc_codegen_{cranelift,ssa}. 2021-06-05 21:59:41 -07:00
bors
df47bce145 Auto merge of #84171 - ricobbe:raw-dylib-via-llvm, r=petrochenkov
Partial support for raw-dylib linkage

First cut of functionality for issue #58713: add support for `#[link(kind = "raw-dylib")]` on `extern` blocks in lib crates compiled to .rlib files.  Does not yet support `#[link_name]` attributes on functions, or the `#[link_ordinal]` attribute, or `#[link(kind = "raw-dylib")]` on `extern` blocks in bin crates; I intend to publish subsequent PRs to fill those gaps.  It's also not yet clear whether this works for functions in `extern "stdcall"` blocks; I also intend to investigate that shortly and make any necessary changes as a follow-on PR.

This implementation calls out to an LLVM function to construct the actual `.idata` sections as temporary `.lib` files on disk and then links those into the generated .rlib.
2021-06-06 03:59:17 +00:00
bors
d7db869e7d Auto merge of #79608 - alessandrod:bpf, r=nagisa
BPF target support

This adds `bpfel-unknown-none` and `bpfeb-unknown-none`, two new no_std targets that generate little and big endian BPF. The approach taken is very similar to the cuda target, where `TargetOptions::obj_is_bitcode` is enabled and code generation is done by the linker.

I added the targets to `dist-various-2`. There are [some tests](https://github.com/alessandrod/bpf-linker/tree/main/tests/assembly) in bpf-linker and I'm planning to add more. Those are currently not ran as part of rust CI.
2021-06-06 01:02:32 +00:00
bjorn3
bc9926a29b Remove unused dylib_ext variable from build.sh 2021-06-05 18:29:28 +02:00
Richard Cobbe
1248ff139d Add first cut of functionality for #58713: support for #[link(kind = "raw-dylib")].
This does not yet support #[link_name] attributes on functions, the #[link_ordinal]
attribute, #[link(kind = "raw-dylib")] on extern blocks in bin crates, or
stdcall functions on 32-bit x86.
2021-06-04 18:01:35 -07:00
bjorn3
dbdeafbc26 Move crate_name field from OngoingCodegen to CrateInfo 2021-06-04 13:20:05 +02:00
bjorn3
646c6043a7 Move windows_subsystem field from CodegenResults to CrateInfo 2021-06-04 13:20:04 +02:00
bjorn3
b6f0b46e20 Allow printing the version of the default codegen backend if it isn't llvm 2021-06-04 13:20:04 +02:00
bjorn3
20e9a1372b Provide default MetadataLoader 2021-06-04 13:20:04 +02:00
bjorn3
b10a442405 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
Camille Gillot
d8d6a5aee0 Revert "Reduce the amount of untracked state in TyCtxt" 2021-06-01 09:05:22 +02:00
Camille GILLOT
228f1c549d Drop metadata_encoding_version. 2021-05-30 20:05:46 +02:00
Camille GILLOT
4e62376059 Make allocator_kind a query. 2021-05-30 19:58:01 +02:00
bjorn3
d6b03451e6 Merge commit '40dd3e2b7089b5e96714e064b731f6dbf17c61a9' into sync_cg_clif-2021-05-27 2021-05-27 13:08:14 +02:00
bjorn3
40dd3e2b70 Rustfmt 2021-05-27 12:40:08 +02:00
bjorn3
56facc424a Rustup to rustc 1.54.0-nightly (ff2c947c0 2021-05-25) 2021-05-27 12:39:40 +02:00
bjorn3
e20fe219e6 Sync from rust 1969c2e312 2021-05-26 14:01:50 +02:00
bjorn3
39ffd9ae4a Allow switching the regalloc algorithm from the commandline 2021-05-26 14:00:58 +02:00
bjorn3
f8c2a7ec00 Rustfmt 2021-05-24 18:41:45 +02:00
bjorn3
9fc56fb2f4 Update rustc bootstrap patch 2021-05-24 18:21:03 +02:00
bjorn3
2f9ca10b1d Update Cranelift, object and gimli 2021-05-24 16:06:54 +02:00
Ralf Jung
9d41e8f90d (try to) fix cranelift 2021-05-23 12:44:05 +02:00
Alessandro Decina
64e08e6b82 Add BPF target
This change adds the bpfel-unknown-none and bpfeb-unknown-none targets
which can be used to generate little endian and big endian BPF
2021-05-23 18:03:27 +10:00
bjorn3
6e06f22bb6 Rustup to rustc 1.54.0-nightly (3e99439f4 2021-05-17) 2021-05-18 19:52:42 +02:00
bjorn3
8a2520c1dc Sync from rust a5560a6a90 2021-05-18 19:42:37 +02:00
bjorn3
beab7510cf Move some code around a bit 2021-05-18 19:41:04 +02:00
Ralf Jung
5e52b61040 CTFE core engine allocation & memory API improvemenets
- make Allocation API offset-based (no more Pointer)
- make Memory API higher-level (combine checking for access and getting access into one operation)
2021-05-18 19:33:55 +02:00
bors
3c53005949 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
bjorn3
a9d033d0e5 Return 0 from cpuid for all subleaves of leaf 7
This is necessary to support the cpufeatures crate

Fixes #1173
2021-05-16 10:46:37 +02:00
bjorn3
328f06718a Update Cranelift 2021-05-16 10:45:18 +02:00
bors
a5da29cf8f 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
Amanieu d'Antras
d342a3490b 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
Camille GILLOT
915d766307 Use () for codegen queries. 2021-05-12 13:58:46 +02:00
Camille GILLOT
3a869ca88c Use () for entry_fn. 2021-05-12 13:58:42 +02:00
Camille GILLOT
f22ab98d4c Use () in dependency_formats. 2021-05-12 13:58:41 +02:00
bors
40a62a998f 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
809722dc13 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